Ejemplo n.º 1
0
//// Initialize
bool wxApp::Initialize(int& argc, wxChar **argv)
{
    if ( !wxAppBase::Initialize(argc, argv) )
        return false;

    // ensure that base cleanup is done if we return too early
    wxCallBaseCleanup callBaseCleanup(this);

#if !defined(__WXMICROWIN__)
    InitCommonControls();
#endif // !defined(__WXMICROWIN__)

#if defined(__SMARTPHONE__) || defined(__POCKETPC__)
    SHInitExtraControls();
#endif

#ifndef __WXWINCE__
    // Don't show a message box if a function such as SHGetFileInfo
    // fails to find a device.
    SetErrorMode(SEM_FAILCRITICALERRORS|SEM_NOOPENFILEERRORBOX);
#endif

    wxOleInitialize();

#if !defined(__WXMICROWIN__) && !defined(__WXWINCE__)
    wxSetKeyboardHook(true);
#endif

    callBaseCleanup.Dismiss();

    return true;
}
Ejemplo n.º 2
0
BOOL WINAPI ConnectionDialog (HWND hParent, PADDCONNECT_DLGPARAMS pDlgParams)
{
	HRSRC hRsrc;
	HGLOBAL hGlob;
	int iRet;
    HCURSOR hCur;

    if( pDlgParams == NULL )
	    return FALSE;
	
    // For WC_SIPPREF
    SHInitExtraControls();

	hRsrc  = FindResource (HINST_RESDLL, MAKEINTRESOURCE(IDD_NETUI_ADD_CONNECTION),RT_DIALOG);
	hGlob = LoadResource (HINST_RESDLL, hRsrc);

    hCur = SetCursor(NULL);
	iRet = DialogBoxParam (HINST_RESDLL, MAKEINTRESOURCE(IDD_NETUI_ADD_CONNECTION),
						   SHGetLastActiveWindow(hParent), DlgProcAddConnect, (LONG)pDlgParams);
    SetCursor(hCur);

    if (iRet == -1) {
        RETAILMSG(1,(DBGTEXT("ConnectionDialog: DialogBoxParams returned err %u"),
                     GetLastError()));
        return FALSE;
    }
    else
        return iRet;
}
Ejemplo n.º 3
0
BOOL CHelloWorldApp::InitInstance()
{
#if defined(WIN32_PLATFORM_PSPC) || defined(WIN32_PLATFORM_WFSP)
    // 在应用程序初始化期间,应调用一次 SHInitExtraControls 以初始化
    // 所有 Windows Mobile 特定控件,如 CAPEDIT 和 SIPPREF。
    SHInitExtraControls();
#endif // WIN32_PLATFORM_PSPC || WIN32_PLATFORM_WFSP

	// 标准初始化
	// 如果未使用这些功能并希望减小
	// 最终可执行文件的大小,则应移除下列
	// 不需要的特定初始化例程
	// 更改用于存储设置的注册表项
	// TODO: 应适当修改该字符串,
	// 例如修改为公司或组织名
	SetRegistryKey(_T("应用程序向导生成的本地应用程序"));

	CHelloWorldDlg dlg;
	m_pMainWnd = &dlg;
	INT_PTR nResponse = dlg.DoModal();
	if (nResponse == IDOK)
	{
		// TODO: 在此处放置处理何时用“确定”来关闭
		//  对话框的代码
	}

	// 由于对话框已关闭,所以将返回 FALSE 以便退出应用程序,
	//  而不是启动应用程序的消息泵。
	return FALSE;
}
Ejemplo n.º 4
0
BOOL Cexcxx_wce_sqlApp::InitInstance()
{
    // SHInitExtraControls should be called once during your application's initialization to initialize any
    // of the Windows Mobile specific controls such as CAPEDIT and SIPPREF.
    SHInitExtraControls();

	// Standard initialization
	// If you are not using these features and wish to reduce the size
	// of your final executable, you should remove from the following
	// the specific initialization routines you do not need
	// Change the registry key under which our settings are stored
	// TODO: You should modify this string to be something appropriate
	// such as the name of your company or organization
	SetRegistryKey(_T("Local AppWizard-Generated Applications"));

	Cexcxx_wce_sqlDlg dlg;
	m_pMainWnd = &dlg;
	INT_PTR nResponse = dlg.DoModal();
	if (nResponse == IDOK)
	{
		// TODO: Place code here to handle when the dialog is
		//  dismissed with OK
	}

	// Since the dialog has been closed, return FALSE so that we exit the
	//  application, rather than start the application's message pump.
	return FALSE;
}
CAygshellHelper::CAygshellHelper( void )
{
    if( m_hAygshellDLL = LoadLibrary( L"aygshell.dll" ) )
    {
        BOOL (*SHInitExtraControls)() = NULL;
        SHInitExtraControls = (BOOL (*)())GetProcAddress( m_hAygshellDLL, L"SHInitExtraControls" );
        SHInitDialog = (LPSHINITDIALOG)GetProcAddress( m_hAygshellDLL, L"SHInitDialog" );
        SHInputDialog = (LPSHINPUTDIALOG)GetProcAddress( m_hAygshellDLL, L"SHInputDialog" );
        SHSipInfo = (LPSHSIPINFO)GetProcAddress( m_hAygshellDLL, L"SHSipInfo" );
        // SHHandleWMSettingChange isn't exported by name, so reference its ordinal.
        // OEMs shouldn't have to do this since they won't conditionally include aygshell.
        SHHandleWMSettingChange = (LPSHHANDLEWMSETTINGCHANGE)GetProcAddress( m_hAygshellDLL, (LPWSTR)MAKELONG(83, 0) );
        if( !(SHInitDialog && SHInputDialog
        	&& SHInitExtraControls && SHSipInfo
        	&& SHHandleWMSettingChange) )
        {
            FreeLibrary( m_hAygshellDLL );
            m_hAygshellDLL = NULL;
        }
        else
        {
            SHInitExtraControls();
        }
    }
}
Ejemplo n.º 6
0
BOOL WINAPI GetResourcePassword (HWND hParent, PNETUI_RESPWD pResPwd)
{
	HRSRC hRsrc;
	HGLOBAL hGlob;
	int iRet;
    HCURSOR hCur;

    // For WC_SIPPREF
    SHInitExtraControls();

	hRsrc  = FindResource (HINST_RESDLL, MAKEINTRESOURCE(IDD_NETUI_RESPWD),RT_DIALOG);
	hGlob = LoadResource (HINST_RESDLL, hRsrc);

    hCur = SetCursor(NULL);
	iRet = DialogBoxParam(HINST_RESDLL, MAKEINTRESOURCE(IDD_NETUI_RESPWD),
                          SHGetLastActiveWindow(hParent), DlgProcResourcePwd,(LONG)pResPwd);
    SetCursor(hCur);

    if (iRet == -1) {
        RETAILMSG(1,(DBGTEXT("GetResourcePassword: DialogBox returned err %u"),
                     GetLastError()));
        return FALSE;
    }
    else
        return iRet;
}
Ejemplo n.º 7
0
//
//   FUNCIÓN: InitInstance(HINSTANCE, int)
//
//   PROPÓSITO: guardar el identificador de instancia y crear la ventana principal
//
//   COMENTARIOS:
//
//        En esta función, se guarda el identificador de instancia en una variable común y
//        se crea y muestra la ventana principal del programa.
//
BOOL InitInstance(HINSTANCE hInstance, int nCmdShow)
{
    HWND hWnd;
    TCHAR szTitle[MAX_LOADSTRING];		// texto de la barra de título
    TCHAR szWindowClass[MAX_LOADSTRING];	// nombre de clase de la ventana principal

    g_hInst = hInstance; // Almacenar identificador de instancia en una variable global

    // SHInitExtraControls se debe llamar una vez durante la inicialización de la aplicación para inicializar cualquiera
    // de los controles específicos del dispositivo como por ejemplo CAPEDIT y SIPPREF.
    SHInitExtraControls();

    LoadString(hInstance, IDS_APP_TITLE, szTitle, MAX_LOADSTRING); 
    LoadString(hInstance, IDC_DLLAUTOEXECUTE, szWindowClass, MAX_LOADSTRING);

    //Si ya se está ejecutando, establezca el foco en la ventana y cierre
    hWnd = FindWindow(szWindowClass, szTitle);	
    if (hWnd) 
    {
        // Establecer el foco en la ventana secundaria en primer lugar
        // "| 0x00000001" se utiliza para traer las ventanas en propiedad a primer plano y
        // activarlas.
        SetForegroundWindow((HWND)((ULONG) hWnd | 0x00000001));
        return 0;
    } 

    if (!MyRegisterClass(hInstance, szWindowClass))
    {
    	return FALSE;
    }

    hWnd = CreateWindow(szWindowClass, szTitle, WS_VISIBLE,
        CW_USEDEFAULT, CW_USEDEFAULT, CW_USEDEFAULT, CW_USEDEFAULT, NULL, NULL, hInstance, NULL);

    if (!hWnd)
    {
        return FALSE;
    }

    // Cuando la ventana principal se crea utilizando CW_USEDEFAULT, el alto de la barra de menús (si se
    // crea una) no se tiene en cuenta. Por lo tanto, la ventana se cambia de tamaño después de crearla
    // si existe una barra de menús
    if (g_hWndMenuBar)
    {
        RECT rc;
        RECT rcMenuBar;

        GetWindowRect(hWnd, &rc);
        GetWindowRect(g_hWndMenuBar, &rcMenuBar);
        rc.bottom -= (rcMenuBar.bottom - rcMenuBar.top);
		
        MoveWindow(hWnd, rc.left, rc.top, rc.right-rc.left, rc.bottom-rc.top, FALSE);
    }

    ShowWindow(hWnd, nCmdShow);
    UpdateWindow(hWnd);


    return TRUE;
}
Ejemplo n.º 8
0
//// Initialize
bool wxApp::Initialize(int& argc_, wxChar **argv_)
{
    if ( !wxAppBase::Initialize(argc_, argv_) )
        return false;

    // ensure that base cleanup is done if we return too early
    wxCallBaseCleanup callBaseCleanup(this);

#if !defined(__WXMICROWIN__)
    InitCommonControls();
#endif // !defined(__WXMICROWIN__)

#if defined(__SMARTPHONE__) || defined(__POCKETPC__)
    SHInitExtraControls();
#endif

    wxOleInitialize();

#if !defined(__WXMICROWIN__) && !defined(__WXWINCE__)
    wxSetKeyboardHook(true);
#endif

    callBaseCleanup.Dismiss();

    return true;
}
Ejemplo n.º 9
0
int WINAPI _tWinMain(HINSTANCE hInstance, HINSTANCE /*hPrevInstance*/, LPTSTR lpstrCmdLine, int nCmdShow)
{
	HRESULT hRes = CMiniPieFrame::ActivatePreviousInstance(hInstance, lpstrCmdLine);

	if(FAILED(hRes) || S_FALSE == hRes)
	{
		return hRes;
	}

	hRes = ::CoInitializeEx(NULL, COINIT_MULTITHREADED);
	ATLASSERT(SUCCEEDED(hRes));

	AtlInitCommonControls(ICC_DATE_CLASSES);
	SHInitExtraControls();

	hRes = _Module.Init(NULL, hInstance);
	ATLASSERT(SUCCEEDED(hRes));

	AtlAxWinInit();

	int nRet = CMiniPieFrame::AppRun(lpstrCmdLine, nCmdShow);

	AtlAxWinTerm();

	_Module.Term();
	::CoUninitialize();

	return nRet;
}
Ejemplo n.º 10
0
// Entry
INT APIENTRY _tWinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, PTSTR ptzCmdLine, INT iCmdShow)
{
	// Active previous instance
	HWND hWnd = FindWindow(STR_AppName, NULL);
	if (hWnd)
	{
		ShowWindow(hWnd, SW_SHOW);
		SetForegroundWindow(HWND(UINT_PTR(hWnd) | 0x00000001));
		return 0;
	}

	// Init library
	CoInitializeEx(NULL, COINIT_MULTITHREADED);
	InitCommonControls();
#ifdef WINCE
	SHInitExtraControls();
#endif

	// Set basic information
	g_hInst = hInstance;
	g_ptzAppName = TStrGet(IDS_AppName);

	// Run the main window
	CAppWnd aw;
	aw.Run(ptzCmdLine, iCmdShow);

	// Free library
	CoUninitialize();

	return 0;
}
Ejemplo n.º 11
0
//
//   FUNCTION: InitInstance(HINSTANCE, int)
//
//   PURPOSE: Saves instance handle and creates main window
//
//   COMMENTS:
//
//        In this function, we save the instance handle in a global variable and
//        create and display the main program window.
//
BOOL InitInstance(HINSTANCE hInstance, int nCmdShow)
{
    HWND hWnd;
    TCHAR szTitle[MAX_LOADSTRING];		// title bar text
    TCHAR szWindowClass[MAX_LOADSTRING];	// main window class name

    g_hInst = hInstance; // Store instance handle in our global variable

    // SHInitExtraControls should be called once during your application's initialization to initialize any
    // of the device specific controls such as CAPEDIT and SIPPREF.
    SHInitExtraControls();

    LoadString(hInstance, IDS_APP_TITLE, szTitle, MAX_LOADSTRING); 
    LoadString(hInstance, IDC_WMRUNNER, szWindowClass, MAX_LOADSTRING);

    //If it is already running, then focus on the window, and exit
    hWnd = FindWindow(szWindowClass, szTitle);	
    if (hWnd) 
    {
        // set focus to foremost child window
        // The "| 0x00000001" is used to bring any owned windows to the foreground and
        // activate them.
        SetForegroundWindow((HWND)((ULONG) hWnd | 0x00000001));
        return 0;
    } 

    if (!MyRegisterClass(hInstance, szWindowClass))
    {
    	return FALSE;
    }

    hWnd = CreateWindow(szWindowClass, szTitle, WS_VISIBLE,
        CW_USEDEFAULT, CW_USEDEFAULT, CW_USEDEFAULT, CW_USEDEFAULT, NULL, NULL, hInstance, NULL);

    if (!hWnd)
    {
        return FALSE;
    }

    // When the main window is created using CW_USEDEFAULT the height of the menubar (if one
    // is created is not taken into account). So we resize the window after creating it
    // if a menubar is present
    if (g_hWndMenuBar)
    {
        RECT rc;
        RECT rcMenuBar;

        GetWindowRect(hWnd, &rc);
        GetWindowRect(g_hWndMenuBar, &rcMenuBar);
        rc.bottom -= (rcMenuBar.bottom - rcMenuBar.top);
		
        MoveWindow(hWnd, rc.left, rc.top, rc.right-rc.left, rc.bottom-rc.top, FALSE);
    }

    ShowWindow(hWnd, nCmdShow);
    UpdateWindow(hWnd);


    return TRUE;
}
Ejemplo n.º 12
0
//
//   関数: InitInstance(HINSTANCE, int)
//
//   目的 : インスタンス ハンドルを保存して、メイン ウィンドウを作成します。
//
//   コメント:
//
//        この関数で、グローバル変数でインスタンス ハンドルを保存し、
//        メイン プログラム ウィンドウを作成および表示します。
//
BOOL InitInstance(HINSTANCE hInstance, int nCmdShow)
{
    HWND hWnd;
    TCHAR szTitle[MAX_LOADSTRING];		// タイトル バー テキスト
    TCHAR szWindowClass[MAX_LOADSTRING];	// メイン ウィンドウ クラス名

    g_hInst = hInstance; // グローバル変数にインスタンス処理を格納します。

    // CAPEDIT および SIPPREF のようなデバイス固有のコントロールを初期化するには、アプリケーションの
    // 初期化中に SHInitExtraControls を一度呼び出す必要があります。
    SHInitExtraControls();

    LoadString(hInstance, IDS_APP_TITLE, szTitle, MAX_LOADSTRING); 
    LoadString(hInstance, IDC_WM6_FILTERS, szWindowClass, MAX_LOADSTRING);

    //既に実行している場合は、ウィンドウにフォーカスを与え、終了します。
    hWnd = FindWindow(szWindowClass, szTitle);	
    if (hWnd) 
    {
        // 最下位の子ウィンドウにフォーカスを設定します。
        // 所有するすべてのウィンドウを前に配置して、アクティブにするために "| 0x00000001"
        // が使用されました。
        SetForegroundWindow((HWND)((ULONG) hWnd | 0x00000001));
        return 0;
    } 

    if (!MyRegisterClass(hInstance, szWindowClass))
    {
    	return FALSE;
    }

    hWnd = CreateWindow(szWindowClass, szTitle, WS_VISIBLE,
        CW_USEDEFAULT, CW_USEDEFAULT, CW_USEDEFAULT, CW_USEDEFAULT, NULL, NULL, hInstance, NULL);

    if (!hWnd)
    {
        return FALSE;
    }

    // CW_USEDEFAULT を使用してメイン ウィンドウを作成する場合、menubar の高さは考慮に
    // 入れられません。menubar が存在する場合は、作成した後で、ウィンドウのサイズを
    // 指定し直します。
    if (g_hWndMenuBar) {
        RECT rc;
        RECT rcMenuBar;

        GetWindowRect(hWnd, &rc);
        GetWindowRect(g_hWndMenuBar, &rcMenuBar);
        rc.bottom -= (rcMenuBar.bottom - rcMenuBar.top);
		
        MoveWindow(hWnd, rc.left, rc.top, rc.right-rc.left, rc.bottom-rc.top, FALSE);
    }

    ShowWindow(hWnd, nCmdShow);
    UpdateWindow(hWnd);


    return TRUE;
}
Ejemplo n.º 13
0
BOOL CVS8_PPC2003_MFCApp::InitInstance()
{
    // SHInitExtraControls should be called once during your application's initialization to initialize any
    // of the Windows Mobile specific controls such as CAPEDIT and SIPPREF.
    SHInitExtraControls();

    Sheet sheet (_T("TraceTool demo")); 
    m_pMainWnd = &sheet;
    sheet.DoModal (); // ShowWindow(SW_SHOW) ; // 

	return TRUE;
}
BOOL CManilla2DConfigApp::InitInstance()
{
    // SHInitExtraControls should be called once during your application's initialization to initialize any
    // of the Windows Mobile specific controls such as CAPEDIT and SIPPREF.
    SHInitExtraControls();

    // Standard initialization
    // If you are not using these features and wish to reduce the size
    // of your final executable, you should remove from the following
    // the specific initialization routines you do not need
    // Change the registry key under which our settings are stored
    SetRegistryKey(_T("M2DC"));

#ifndef _DEBUG
    if(!WinCeFileUtils::FileExists(M2DC::GetPathToHTCHomeSettingsXmlFileActual()))
    {
        CString msg = TEXT("Unable to find Manilla 2D settings file.\n");
        msg += TEXT("Is Manilla 2D installed?\n");
        msg += TEXT("Exiting...");

        AfxMessageBox(msg);
        return FALSE;
    }
#endif

    M2DC::BackupHTCHomeSettingsXml(false);

    CManilla2DConfigDlg dlg(TEXT("Manilla 2D Customizer"));
    dlg.SetupPages();

    if(dlg.DoModal() == IDOK)
    {
        M2DC::EndMakingChanges();
    }

    M2DC::RestoreAndReEnableTodayScreen();

    // Since the dialog has been closed, return FALSE so that we exit the
    //  application, rather than start the application's message pump.
    return FALSE;
}
Ejemplo n.º 15
0
BOOL CWMADHOCTRACKERApp::InitInstance()
{
    // SHInitExtraControls doit être appelé une fois lors de l'initialisation de votre application afin d'initialiser
    // l'un des contrôles spécifiques à Windows Mobile, tels que CAPEDIT et SIPPREF.
    SHInitExtraControls();

	if (!AfxSocketInit())
	{
		AfxMessageBox(IDP_SOCKETS_INIT_FAILED);
		return FALSE;
	}

	AfxEnableControlContainer();

	// Initialisation standard
	// Si vous n'utilisez pas ces fonctionnalités et que vous souhaitez réduire la taille
	// de votre exécutable final, vous devez supprimer ci-dessous
	// les routines d'initialisation spécifiques dont vous n'avez pas besoin.
	// Changez la clé de Registre sous laquelle nos paramètres sont enregistrés
	// TODO : modifiez cette chaîne avec des informations appropriées,
	// telles que le nom de votre société ou organisation
	SetRegistryKey(_T("Applications locales générées par AppWizard"));

	CWMADHOCTRACKERDlg dlg;
	m_pMainWnd = &dlg;
	INT_PTR nResponse = dlg.DoModal();
	
	if (nResponse == IDOK)
	{
		// TODO : placez ici le code définissant le comportement lorsque la boîte de dialogue est
		//  fermée avec OK
	}

	// Lorsque la boîte de dialogue est fermée, retourner FALSE afin de quitter
	//  l'application, plutôt que de démarrer la pompe de messages de l'application.
	return FALSE;
}
Ejemplo n.º 16
0
//
//   FUNCTION: InitInstance(HINSTANCE, int)
//
//   PURPOSE: Saves instance handle and creates main window
//
//   COMMENTS:
//
//        In this function, we save the instance handle in a global variable and
//        create and display the main program window.
//
BOOL InitInstance(HINSTANCE hInstance, int nCmdShow)
{
	INT nNo;
	RECT rc;
	ImgFmt fmt0;
	ImgFmt* fmt1;
	ImageRes tRes;
	TCHAR szTitle[MAX_LOADSTRING];			// Title bar text
    TCHAR szWindowClass[MAX_LOADSTRING];	// Main window class name
	INT nX, nY, nSWidth, nSHeight;			// These cordinates are used to align windows controls over the 
											// available screen area irrespective of the LCD quality
	
	//Initailize global variavles
	g_hinstCurr = hInstance;		 // Store instance handle in our global variable
	g_ahmnuVdoColorFmts = NULL;
	g_ahmnuStillColorFmts = NULL;
	g_bVideoMode = TRUE;			 // Set to VideoMode as the default mode of operation
	g_bVMod = TRUE;
	g_wsColorFmt = L"";
	g_tImgRes.nWidth = 0;
	g_tImgRes.nHeight = 0;
	g_bStressTest = FALSE;
	g_bNowRecording = FALSE;
	g_hwndMain = NULL;
	g_hwndMenuBar = NULL;
		
	
	// SHInitExtraControls should be called once during your application's 
	// initialization to initialize any of the device specific controls
	// such as CAPEDIT and SIPPREF.
    SHInitExtraControls();

    LoadString(hInstance, IDS_APP_TITLE, szTitle, MAX_LOADSTRING); 
    LoadString(hInstance, IDC_DSHOWTESTAPP, szWindowClass, MAX_LOADSTRING);

    //If it is already running, then focus on the window, and exit
    g_hwndMain = FindWindow(szWindowClass, szTitle);	
    if(g_hwndMain) 
    {
        // set focus to foremost child window
        // The "| 0x00000001" is used to bring any owned windows to the foreground and
        // activate them.
        SetForegroundWindow((HWND)((ULONG) g_hwndMain | 0x00000001));
        return 0;
    } 

    if(!MyRegisterClass(hInstance, szWindowClass))
    {
    	return FALSE;
    }

	// Creating the main window
    g_hwndMain = CreateWindow(szWindowClass, szTitle, WS_VISIBLE,\
        CW_USEDEFAULT, CW_USEDEFAULT, CW_USEDEFAULT, CW_USEDEFAULT,\
														NULL, NULL, hInstance, NULL);

    if (!g_hwndMain)
    {
        return FALSE;
    }

	// When the main window is created using CW_USEDEFAULT the height of the menubar (if one
    // is created is not taken into account). So we resize the window after creating it
    // if a menubar is present
	if (g_hwndMenuBar)
    {
        RECT rc;
        RECT rcMenuBar;

        GetWindowRect(g_hwndMain, &rc);
        GetWindowRect(g_hwndMenuBar, &rcMenuBar);
		rc.bottom -= (rcMenuBar.bottom - rcMenuBar.top);
		
        MoveWindow(g_hwndMain, rc.left, rc.top, rc.right-rc.left, rc.bottom-rc.top, FALSE);
		
		g_tRc.top = rc.top;
		g_tRc.left = rc.left;
		g_tRc.bottom = rc.bottom;
		g_tRc.right = rc.right;
    }
	else
	{
		//Get the allowed work area for UI
		SystemParametersInfo(SPI_GETWORKAREA, 0, &g_tRc, 0);
	}

	//Initialize the screen aligning cordinates 
	nX = MARGIN_GAP;
	nY = MARGIN_GAP;
	nSWidth = (g_tRc.right-g_tRc.left-2*MARGIN_GAP);
	nSHeight = (g_tRc.bottom-g_tRc.top-2*MARGIN_GAP);
		
	//Locate the camera device, Implement and Run Directshow filter graph
	g_Prop.FindFirstCam(&g_wsaCamIDs[0]);
	g_Prop.FindNextCam(&g_wsaCamIDs[1]);
	rc.left = nX;
	rc.top = nY;
	rc.bottom = nY+(nSHeight-2*MARGIN_GAP)*3/4;
	rc.right = nX+nSWidth;

	//Here prompt user to select the camera from a drop down and 
	//........
	//........
	//........
	// Here the First found camera is taken as the default capture device
	Invoke(g_hwndMain, rc, g_wsaCamIDs[0].c_str()); 
		
	LoadString(hInstance, STR_EDIT, szWindowClass, MAX_LOADSTRING); 
    LoadString(hInstance, STR_BLANK, szTitle, MAX_LOADSTRING);
	CreateWindow(szWindowClass, szTitle, WS_CHILD|WS_VISIBLE|ES_LEFT|WS_BORDER|WS_DISABLED, nX, nY, nSWidth, (nSHeight-2*MARGIN_GAP)*3/4, g_hwndMain, (HMENU)IDC_PREVIEW, hInstance, NULL);
	nY +=  (nSHeight-2*MARGIN_GAP)*3/4 + MARGIN_GAP;
	
	LoadString(hInstance, STR_BUTTON, szWindowClass, MAX_LOADSTRING); 
    LoadString(hInstance, STR_CAPTURE, szTitle, MAX_LOADSTRING);
	CreateWindow(szWindowClass, szTitle, WS_CHILD|WS_VISIBLE|BS_PUSHBUTTON, nX, nY, (nSWidth-2*MARGIN_GAP)/4 , (nSHeight-2*MARGIN_GAP)/12, g_hwndMain, (HMENU)IDC_CAPTURE, hInstance, NULL);
	nX += (nSWidth-2*MARGIN_GAP)/4 + MARGIN_GAP;
		
	LoadString(hInstance, STR_STATIC, szWindowClass, MAX_LOADSTRING); 
    LoadString(hInstance, STR_VMODE, szTitle, MAX_LOADSTRING);
	CreateWindow(szWindowClass, szTitle, WS_CHILD|WS_VISIBLE|SS_CENTER, nX, nY, (nSWidth-2*MARGIN_GAP)/2, (nSHeight-2*MARGIN_GAP)/12, g_hwndMain, (HMENU)IDC_MODE, hInstance, NULL);
	nX += (nSWidth-2*MARGIN_GAP)/2 + MARGIN_GAP;
	
	LoadString(hInstance, STR_COMBOBOX, szWindowClass, MAX_LOADSTRING); 
    LoadString(hInstance, STR_BLANK, szTitle, MAX_LOADSTRING);
	CreateWindow(szWindowClass, szTitle, WS_CHILD|WS_VISIBLE|SS_LEFT, nX, nY, (nSWidth-2*MARGIN_GAP)/4, (nSHeight-2*MARGIN_GAP)/12, g_hwndMain, (HMENU)IDC_CAMID, hInstance, NULL);
	
	nX = MARGIN_GAP;
	nY += (nSHeight-2*MARGIN_GAP)/12 + MARGIN_GAP;

	LoadString(hInstance, STR_BLANK, szTitle, MAX_LOADSTRING);
	CreateWindowEx(WS_EX_STATICEDGE, TRACKBAR_CLASS, szTitle, WS_CHILD|WS_VISIBLE|TBS_HORZ, nX, nY, nSWidth/2, (nSHeight-2*MARGIN_GAP)/12, g_hwndMain, (HMENU)IDC_SLIDER, hInstance, NULL);
	nX += nSWidth/2 + MARGIN_GAP;

	LoadString(hInstance, STR_EDIT, szWindowClass, MAX_LOADSTRING); 
    LoadString(hInstance, STR_BLANK, szTitle, MAX_LOADSTRING);
	CreateWindow(szWindowClass, szTitle, WS_CHILD|WS_VISIBLE|ES_LEFT|WS_BORDER|ES_NUMBER|WS_DISABLED, nX, nY, nSWidth/4, (nSHeight-2*MARGIN_GAP)/12, g_hwndMain, (HMENU)IDC_POS, hInstance, NULL);

	nY += (nSHeight-2*MARGIN_GAP)/12;
	nX = MARGIN_GAP;
	LoadString(hInstance, STR_STATIC, szWindowClass, MAX_LOADSTRING); 
    LoadString(hInstance, PRO_BRIGHTNESS, szTitle, MAX_LOADSTRING);
	CreateWindowEx(WS_EX_STATICEDGE, szWindowClass, szTitle, WS_CHILD|WS_VISIBLE|SS_CENTER, nX, nY, nSWidth/2, (nSHeight-2*MARGIN_GAP)/12, g_hwndMain, (HMENU)IDC_PROP, hInstance, NULL);
	
	nY = nY;
	nX += nSWidth/2 + MARGIN_GAP;
	CreateWindow(L"BUTTON", L"Stress ", WS_CHILD|WS_VISIBLE|BS_AUTOCHECKBOX|WS_DISABLED, nX, nY, nSWidth/4, (nSHeight-2*MARGIN_GAP)/12, g_hwndMain, (HMENU)IDC_STRESS, hInstance, NULL);
	
	nY += 2*MARGIN_GAP;
	nX += nSWidth/4 + MARGIN_GAP;
	CreateWindow(L"EDIT", L"00:00:00", WS_CHILD|WS_VISIBLE|ES_LEFT|WS_DISABLED|ES_READONLY|WS_BORDER, nX, nY, (nSWidth-nX+MARGIN_GAP), (nSHeight-2*MARGIN_GAP)/15, g_hwndMain, (HMENU)IDC_TIMER, hInstance, NULL);

	// Retrive Video and Still capabilities and populate Dynamic menu extension
	g_Prop.EnumFirstCap(V, &fmt0, &nNo);
	g_nNoOfVdoCap = nNo;
	fmt1 = new ImgFmt[nNo-1];
	g_Prop.EnumOtherCap(V, fmt1, nNo);
	BuildMenuEx(fmt0, fmt1, nNo, TRUE);
	Set_ImgRes(0);							//Setting CAPTURE_PIN to Res. Idx zero
	delete [] fmt1;	

	g_Prop.EnumFirstCap(S, &fmt0, &nNo);
	g_nNoOfStillCap = nNo;
	fmt1 = new ImgFmt[nNo-1];
	g_Prop.EnumOtherCap(S, fmt1, nNo);
	BuildMenuEx(fmt0, fmt1, nNo, FALSE);
	tRes.nHeight=fmt0.nMaxHeight;
	tRes.nWidth=fmt0.nMaxWidth;
	g_Prop.Set_Resolution(&tRes, S);		//Setting STILL_PIN to Res. Idx zero
	delete [] fmt1;	
	
	//Enumuration of PREVIEW_PIN First capability and keep it always 
	//with the lowest resolution
	g_Prop.EnumFirstCap(P, &fmt0, &nNo);
	tRes.nHeight=fmt0.nMaxHeight;
	tRes.nWidth=fmt0.nMaxWidth;
	g_Prop.Set_Resolution(&tRes, P);		//Setting PREVIEW_PIN to Res. Idx zero
		
	//Checking the Image properties supported by the camera driver
	for(int i=0; i<NO_OF_IMAGE_PROP; i++)
	{
		TCHAR waTemp[BUF_LENGTH];
		HRESULT hr;

		g_tImgTbl.vProp = IProp[i];
		hr = g_Prop.Get_PropRng(IMG, &g_tImgTbl);
		if(hr == E_PROP_ID_UNSUPPORTED)
		{
			wsprintf(waTemp, L"\n--Image Property Id:-%d NOT Supported----\n",i);
			OutputDebugString(waTemp);
			
			g_hmnuCurr = (HMENU) SendMessage(g_hwndMenuBar, SHCMBM_GETSUBMENU, 0, IDM_SETTINGS);
			EnableMenuItem(GetSubMenu(g_hmnuCurr, 9), i, MF_BYPOSITION|MF_GRAYED);
		}
	}

	//Checking the Camera properties supported by the camera driver
	for(int i=0; i<NO_OF_CAMERA_PROP; i++)
	{
		TCHAR waTemp[BUF_LENGTH];
		HRESULT hr;

		g_tCamTbl.p = CProp[i];
		hr = g_Prop.Get_PropRng(CAM, &g_tCamTbl);
		if(hr == E_PROP_ID_UNSUPPORTED)
		{
			wsprintf(waTemp, L"\n--Camera Property Id:-%d NOT Supported----\n",i);
			OutputDebugString(waTemp);
			
			g_hmnuCurr = (HMENU) SendMessage(g_hwndMenuBar, SHCMBM_GETSUBMENU, 0, IDM_SETTINGS);
			EnableMenuItem(GetSubMenu(g_hmnuCurr, 8), i, MF_BYPOSITION|MF_GRAYED);
		}
	}

	//Set Initial property as Brightness
	Get_ImgProp(PRO_BRIGHTNESS, 0);
	
	//Check menu Items for Video Resolution and ColorFormat menu
	/*
	g_hmnuCurr = g_hmnuVideoSub;
	CheckMenuRadioItem(g_hmnuCurr, 0, (g_nNoOfVdoCap-1), 0, MF_BYPOSITION);
	g_hmnuCurr = g_ahmnuVdoColorFmts[0];
	CheckMenuRadioItem(g_hmnuCurr, 0, (g_nNoOfVdoCap-1), 0, MF_BYPOSITION);
	*/
	//Check menu Items for Still Resolution and ColorFormat menu
	g_hmnuCurr = g_hmnuStillSub;
	CheckMenuRadioItem(g_hmnuCurr, 0, (g_nNoOfStillCap-1), 0, MF_BYPOSITION);
	g_hmnuCurr = g_ahmnuStillColorFmts[0];
	CheckMenuRadioItem(g_hmnuCurr, 0, (g_nNoOfStillCap-1), 0, MF_BYPOSITION);
	
	//Display the selected Camera Name
	g_hwndTemp = GetDlgItem(g_hwndMain,IDC_CAMID);
	SendMessage(g_hwndTemp, WM_SETTEXT, 0, (LPARAM)g_wsaCamIDs[0].c_str());	

	// Redraw
    InvalidateRect(g_hwndMain, NULL, TRUE);
    UpdateWindow(g_hwndMain);
	

	ShowWindow(g_hwndMain, nCmdShow);
    UpdateWindow(g_hwndMain);
    SetForegroundWindow(g_hwndMain);

	return TRUE;
}
Ejemplo n.º 17
0
//
//   FUNCTION: InitInstance(HINSTANCE, int)
//
//   PURPOSE: Saves instance handle and creates main window
//
//   COMMENTS:
//
//        In this function, we save the instance handle in a global variable and
//        create and display the main program window.
//
BOOL InitInstance(HINSTANCE hInstance, int nCmdShow)
{
    assert(GetInstance() == hInstance);

    TCHAR szTitle[MAX_LOADSTRING];		// title bar text
    TCHAR szWindowClass[MAX_LOADSTRING];	// main window class name


#ifdef WIN32_PLATFORM_PSPC
    // SHInitExtraControls should be called once during your application's initialization to initialize any
    // of the Pocket PC special controls such as CAPEDIT and SIPPREF.
    SHInitExtraControls();
#endif // WIN32_PLATFORM_PSPC

    LoadString(hInstance, IDS_APP_TITLE, szTitle, MAX_LOADSTRING); 
    LoadString(hInstance, IDC_INFOMAN, szWindowClass, MAX_LOADSTRING);

    //If it is already running, then focus on the window, and exit
    HWND hWnd = FindWindow(szWindowClass, szTitle);	
    if (hWnd) 
    {
        // set focus to foremost child window
        // The "| 0x00000001" is used to bring any owned windows to the foreground and
        // activate them.
        SetForegroundWindow((HWND)((ULONG) hWnd | 0x00000001));
        return 0;
    } 
   
    LogAddDebuggerLog(eLogAlways);

    status_t err = DataStoreInit();
    if (errNone != err)
    {
        if (memErrNotEnoughSpace == err)
            Alert(IDS_ALERT_NOT_ENOUGH_MEMORY);
        CleanUp();
        return FALSE;
    }

    if (NULL == GetPreferences() || NULL == GetHyperlinkHandler())
    {
        Alert(IDS_ALERT_NOT_ENOUGH_MEMORY);
        CleanUp();
        return FALSE;
    }

    StylePrepareStaticStyles();
    MainWindow* w = MainWindow::create(szTitle, szWindowClass);
    if (NULL == w)
    {
        // TODO: show some alert
        CleanUp();
        return FALSE;
    }

    w->show(nCmdShow);
    w->update();

    RunTests(w->handle());
    return TRUE;
}
Ejemplo n.º 18
0
BOOL CPrssrApp::InitInstance() {
	LOG0(1, "CPrssrApp::InitInstance()");

	LoadSSL();
	// init win sock
	WSADATA wsaData;
	WSAStartup(0x0101, &wsaData);

	// Change the registry key under which our settings are stored.
	SetRegistryKey(_T("DaProfik"));

	// register wnd class
	WNDCLASS wc = { 0 };
	wc.lpfnWndProc = ::DefWindowProc;
	wc.hInstance = AfxGetInstanceHandle();
	wc.hbrBackground = (HBRUSH) (COLOR_WINDOW + 1);
	wc.lpszMenuName = NULL;
	wc.lpszClassName = PRSSR_CLASS_NAME;
	if (!AfxRegisterClass(&wc))
		return FALSE;

	CFeedView::Register();
	CGroupView::Register();
	CTextProgressCtrl::Register();
	CInfoBar::Register();

	// get DPI
	HDC hdcScreen = ::GetDC(NULL);
	int nSystemDPI = ::GetDeviceCaps(hdcScreen, LOGPIXELSX);
	::ReleaseDC(NULL, hdcScreen);

	// load the resource library according to the system DPI
	CString resLibName;
	resLibName.Format(_T("res.%03d.dll"), nSystemDPI);
	m_hResDLL = LoadLibrary(resLibName);
	if (m_hResDLL == NULL) return Error(IDS_INTERNAL_ERROR, 0x00000002);

	if (!InitHTMLControl(AfxGetInstanceHandle()))
		return 0;

	// Initialize the control
	INITCOMMONCONTROLSEX icce;
	icce.dwSize = sizeof(icce);
	icce.dwICC = ICC_DATE_CLASSES | ICC_LISTVIEW_CLASSES | ICC_PROGRESS_CLASS | ICC_UPDOWN_CLASS | ICC_TREEVIEW_CLASSES | ICC_TOOLTIP_CLASSES | ICC_TAB_CLASSES;
	InitCommonControlsEx(&icce);

	SHInitExtraControls();

	// frame
	CMainFrame* pFrame = new CMainFrame();
	m_pMainWnd = pFrame;

	// create and load the frame with its resources
	pFrame->LoadFrame(IDR_MAINFRAME, WS_OVERLAPPEDWINDOW, NULL, NULL);

	// process cmd line
	CString strCmdLine = m_lpCmdLine;

	// minimized ?
	if (strCmdLine.Find(_T("/minimized")) != -1) {
		pFrame->ShowWindow(SW_MINIMIZE);
	}
	else {
		pFrame->ShowWindow(m_nCmdShow);
		pFrame->UpdateWindow();
	}

	if (strCmdLine.Find(_T("/updateall")) != -1) {
		pFrame->PostMessage(UWM_UPDATE_ALL);
	}

	int npos;
	if ((npos = strCmdLine.Find(_T("/opensite"))) != -1) {
		CString strSite = strCmdLine.Mid(npos + 10);
		int site;
		if (swscanf(strSite.GetBuffer(strSite.GetLength()), _T("%d"), &site) == 1) {
			// after sites are loaded, site with this value is opened
			pFrame->PostMessage(UWM_OPEN_SITE, site, 0);
		}
	}

	if ((npos = strCmdLine.Find(_T("/openitem"))) != -1) {
		CString sPar = strCmdLine.Mid(npos + 10);

		int site, feedIdx;
		if (swscanf(sPar.GetBuffer(sPar.GetLength()), _T("%d %d"), &site, &feedIdx) == 2) {
			pFrame->PostMessage(UWM_OPEN_FEEDITEM, site, (LPARAM) feedIdx);
		}
		sPar.ReleaseBuffer();
	}

	return TRUE;
}
Ejemplo n.º 19
0
BOOL CPingCheckApp::InitInstance()
{
#if defined(WIN32_PLATFORM_PSPC) || defined(WIN32_PLATFORM_WFSP)
    // SHInitExtraControls should be called once during your application's initialization to initialize any
    // of the Windows Mobile specific controls such as CAPEDIT and SIPPREF.
    SHInitExtraControls();
#endif // WIN32_PLATFORM_PSPC || WIN32_PLATFORM_WFSP

	// Standard initialization
	// If you are not using these features and wish to reduce the size
	// of your final executable, you should remove from the following
	// the specific initialization routines you do not need
	// Change the registry key under which our settings are stored
	// TODO: You should modify this string to be something appropriate
	// such as the name of your company or organization
	SetRegistryKey(_T("Local AppWizard-Generated Applications"));



	HANDLE hMutex = CreateMutex(NULL, TRUE, DEFAULT_MUTEX_NAME);


	if(!hMutex) 
    {
        return FALSE;
    }


	if( GetLastError() == ERROR_ALREADY_EXISTS )
	{
		HWND hWnd = FindWindow(NULL, _T("PingCheck") );

		if( MessageBox(GetForegroundWindow(), _T("This Program is Already running, Do you want to exit previous program?"), _T("Warning"), MB_YESNO) == IDYES)
		{

			ReleaseMutex(hMutex);

			DestroyWindow(hWnd);
			
			SendMessage(hWnd, WM_STOP_CHECK, 0, 0);

			MessageBox(GetForegroundWindow(), _T("Previous program is closed, Please restart the program"), _T("Complete"), MB_OK);
		}

		CloseHandle(hMutex);
		return S_OK;
	}
	else
	{

		CPingCheckDlg dlg;
		m_pMainWnd = &dlg;

		INT_PTR nResponse = dlg.DoModal();


		if (nResponse == IDOK)
		{
			// TODO: Place code here to handle when the dialog is
			//  dismissed with OK
		}
	}

	ReleaseMutex(hMutex);
	CloseHandle(hMutex);


	// Since the dialog has been closed, return FALSE so that we exit the
	//  application, rather than start the application's message pump.
	return FALSE;
}
Ejemplo n.º 20
0
int WINAPI _tWinMain(HINSTANCE hInstance, HINSTANCE /*hPrevInstance*/, LPTSTR lpstrCmdLine, int nCmdShow)
{
#ifdef __EXPIRATION__
	// Program Expiration routines
	CTime expirationTime(2010,	// year
		2,					// month
		30,					// date
		23,					// hour 24
		59,					// minute
		59);				// second
	CTime currentTime = CTime::GetCurrentTime();

    CTimeSpan leftTime = expirationTime - currentTime;   

	// 사용 기간이 남았을 경우
	if(leftTime.GetTotalSeconds() > 0)
    {
		 CString msg;
		 msg = L"";
		 msg += L"This is a trial version of BTools2\n";
		 msg += expirationTime.Format(L"Expiration date :\n %Y-%m-%d  %H:%M:%S\n\n");
		 msg += leftTime.Format(L"%D day(s) and\n %H:%M:%S left" );
     
		 // 사용 기간이 3일 미만 남았을 경우
		 if(leftTime.GetDays() < 7)
		 {
			 msg = leftTime.Format(L"This software will expire after %D day(s)");// %H Hour(s) %M Minute(s)");
			 //AtlMessageBox(NULL, msg.GetBuffer(), L"Expiration Warning");
		 }
		 //AfxMessageBox(msg);
    }
    else // 사용 기간이 만료된 경우
    {
		CString msg("This is a trial version of BTools2\n"
				"If you want to use this software more\n"
				"Please contact to me.\[email protected]\n"
				"Thank you for your interest\n");

		msg += expirationTime.Format(L"Expiration date :\n %Y-%m-%d  %H:%M\n\n");
		msg += leftTime.Format(L"%D day(s) and\n %H:%M:%S passed" );
        //msg.Format(L"This software is submitted for the Windows Mobile Contest");
		//AtlMessageBox(NULL, msg.GetBuffer(), L"Warning");
		return FALSE;
	 }

#endif

#ifdef __TSTORE_ARM__0
	// ARM
	T_RETURN ret;
	TAPPID *APPID = TSTORE_APPLICATION_ID;

	bool aSuccess=true;

	T_RETURN res; 
	ARM_PLUGIN_Initialize(&res,APPID);
	if (res.code == ARM_SUCCESS) 
	{
		ARM_PLUGIN_CheckLicense(&res); 
		if (res.code == ARM_SUCCESS) 
		{ 
			ARM_PLUGIN_RequestLicense(&res); 
			if (res.code !=ARM_SUCCESS) 
			{ //실패시 구현 
				aSuccess=false;
				TCHAR wszMsg[1024];
				if(ret.pMsg)
				{
					ansi_to_unicode(ret.pMsg, strlen(ret.pMsg), wszMsg, 1024);
					::AtlMessageBox(NULL, wszMsg, L"[ARM]Request License");
				}
			}
		
		} 
		else 
		{//실패시 메시 구현 
			aSuccess=false;

			TCHAR wszMsg[1024];

			switch(res.code)
			{
			case CLICENSE_DENY:
			case CLICENSE_NOT_EXIST:
			case CLICENSE_EXPIRED:
			case CLICENSE_INVALID:
				{
					if(ret.pMsg)
					{
						ansi_to_unicode(ret.pMsg, strlen(ret.pMsg), wszMsg, 1024);
						::AtlMessageBox(NULL, wszMsg, L"[ARM]Check License");
					}
				}

			default:
				;
			}
		} 
	} 
	else 
	{ 
		aSuccess=false; 
	} 
	ARM_PLUGIN_Uninitialize(&res); 


	//if (! aSuccess) return 0;//PostQuitMessage(0); 

#endif

	//CAboutDlg aboutDlg;	aboutDlg.DoModal();
    //
	HRESULT hRes = CBTools2Frame::ActivatePreviousInstance(hInstance, lpstrCmdLine);

	if(FAILED(hRes) || S_FALSE == hRes)
	{
		return hRes;
	}

	hRes = ::CoInitializeEx(NULL, COINIT_MULTITHREADED);
	ATLASSERT(SUCCEEDED(hRes));

	AtlInitCommonControls(ICC_DATE_CLASSES);
	SHInitExtraControls();

	hRes = _Module.Init(NULL, hInstance);
	ATLASSERT(SUCCEEDED(hRes));

	int nRet = CBTools2Frame::AppRun(lpstrCmdLine, nCmdShow);

	_Module.Term();
	::CoUninitialize();

	return nRet;
}