Exemple #1
0
err_t beeLogo()
{
	// вызвать диалог
	if (DialogBoxA(GetModuleHandleA("bee2.dll"), 
		"BEELOGO", beeFindMainWindow(), (DLGPROC)beeLogoDlgProc) == -1)
		return ERR_SYS;
	return ERR_OK;
}
// Main Entry-point
int CALLBACK WinMain ( HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine, int nCmdShow )
{
	// Vertify license.
	//if ( true )//CheckOnline ( GetLicense () ) )
		DialogBoxA ( hInstance, MAKEINTRESOURCE ( IDD_DIALOG1 ), NULL, MainProc );
	//else
	//	DialogBoxA ( hInstance, MAKEINTRESOURCE ( IDD_DIALOG2 ), NULL, LicenseProc );

	// Close the application
	DWORD dwExitCode;
	GetExitCodeProcess ( GetCurrentProcess (), &dwExitCode );
	TerminateProcess ( GetCurrentProcess (), dwExitCode );

	return 0;
}
Exemple #3
0
BOOL CALLBACK DialogProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam) {  
     
          hFieldColor = CreateSolidBrush(EDITCOLOR);
          
          switch (message) {                
                                
                                case WM_CLOSE:               DeleteObject(hFieldColor);  
                                                             EndDialog(hWnd,0);
                                break;

                                case WM_INITDIALOG: j_ran(hWnd);
                                                                  
                                break; 

                                case WM_CTLCOLOREDIT:
      
                                                             SetBkColor((HDC) wParam, EDITCOLOR);
                                                             SetTextColor((HDC) wParam, TEXTCOLOR);
                                                             return(LRESULT)hFieldColor;
                                                             
                                break;
                                     
                                case WM_COMMAND: switch (LOWORD(wParam)) {
                                      
                                                             case ID_ABOUT:   
                                                                  
                                                                              DialogBoxA(hInst, MAKEINTRESOURCE(IDD_DLGABOUT), hWnd, DialogProc);
                                                                              default: DefWindowProc(hWnd, message, wParam, lParam);

                                                             break;                                     
                     
                                                             case ID_REGISTER: 

                                                                              j_dec(hWnd);  
                                                             break; 	
                                                                                  
                                                             case ID_CLOSE:   
                                                                              
                                                                              EndDialog (hWnd, 0);
                                                             
                                                             break;       

                                }

          }
 
 return(0);
}
Exemple #4
0
int APIENTRY WinMain(HINSTANCE hInstance,
                     HINSTANCE hPrevInstance,
                     LPSTR     lpCmdLine,
                     int       nCmdShow)
{
	// Prevent multiples instances of this app.
	CreateMutexA(NULL, TRUE, APPTITLE);

	if (GetLastError() == ERROR_ALREADY_EXISTS)
		return 0;

	RegisterDialogClass("SRB2MP", MainWndproc, hInstance);

	DialogBoxA(hInstance, (LPCSTR)IDD_MAIN, NULL, DialogProc);

	return 0;
}
Exemple #5
0
static void test_initial_focus(void)
{
    /* Test 1:
     * This test intentionally returns FALSE in response to WM_INITDIALOG
     * without setting focus to a control. This is not allowed according to
     * MSDN, but it is exactly what MFC's CFormView does.
     *
     * Since the WM_INITDIALOG handler returns FALSE without setting the focus,
     * the focus should initially be NULL. Later, when we manually set focus to
     * the dialog, the default handler should set focus to the first control that
     * is "visible, not disabled, and has the WS_TABSTOP style" (MSDN). Because the
     * second radio button has been checked, it should be the first control
     * that meets these criteria and should receive the focus.
     */

    g_bInitialFocusInitDlgResult = FALSE;
    g_hwndInitialFocusT1 = (HWND) -1;
    g_hwndInitialFocusT2 = (HWND) -1;
    g_styleInitialFocusT1 = -1;
    g_styleInitialFocusT2 = -1;

    DialogBoxA(g_hinst, "RADIO_TEST_DIALOG", NULL, delayFocusDlgWinProc);

    ok (((g_styleInitialFocusT1 & WS_TABSTOP) == 0),
       "Error in wrc - Detected WS_TABSTOP as default style for GROUPBOX\n");

    ok (((g_styleInitialFocusT2 & WS_VISIBLE) == 0),
       "Modal dialogs should not be shown until the message queue first goes empty\n");

    ok ((g_hwndInitialFocusT1 == NULL),
        "Error in initial focus when WM_INITDIALOG returned FALSE: "
        "Expected NULL focus, got %s (%p).\n",
        GetHwndString(g_hwndInitialFocusT1), g_hwndInitialFocusT1);

    ok ((g_hwndInitialFocusT2 == g_hwndButton2),
        "Error after first SetFocus() when WM_INITDIALOG returned FALSE: "
        "Expected the second button (%p), got %s (%p).\n",
        g_hwndButton2, GetHwndString(g_hwndInitialFocusT2),
        g_hwndInitialFocusT2);

    /* Test 2:
     * This is the same as above, except WM_INITDIALOG is made to return TRUE.
     * This should cause the focus to go to the second radio button right away
     * and stay there (until the user indicates otherwise).
     */

    g_bInitialFocusInitDlgResult = TRUE;
    g_hwndInitialFocusT1 = (HWND) -1;
    g_hwndInitialFocusT2 = (HWND) -1;
    g_styleInitialFocusT1 = -1;
    g_styleInitialFocusT2 = -1;

    DialogBoxA(g_hinst, "RADIO_TEST_DIALOG", NULL, delayFocusDlgWinProc);

    ok ((g_hwndInitialFocusT1 == g_hwndButton2),
       "Error in initial focus when WM_INITDIALOG returned TRUE: "
       "Expected the second button (%p), got %s (%p).\n",
       g_hwndButton2, GetHwndString(g_hwndInitialFocusT1),
       g_hwndInitialFocusT1);

    ok ((g_hwndInitialFocusT2 == g_hwndButton2),
       "Error after first SetFocus() when WM_INITDIALOG returned TRUE: "
       "Expected the second button (%p), got %s (%p).\n",
       g_hwndButton2, GetHwndString(g_hwndInitialFocusT2),
       g_hwndInitialFocusT2);

    /* Test 3:
     * If the dialog has DS_CONTROL and it's not visible then we shouldn't change focus */
    {
        HWND hDlg;
        HRSRC hResource;
        HANDLE hTemplate;
        DLGTEMPLATE* pTemplate;

        hResource = FindResourceA(g_hinst,"FOCUS_TEST_DIALOG", RT_DIALOG);
        hTemplate = LoadResource(g_hinst, hResource);
        pTemplate = LockResource(hTemplate);

        g_hwndInitialFocusT1 = 0;
        hDlg = CreateDialogIndirectParamA(g_hinst, pTemplate, NULL, focusDlgWinProc, 0);
        ok (hDlg != 0, "Failed to create test dialog.\n");

        ok ((g_hwndInitialFocusT1 == 0),
            "Focus should not be set for an invisible DS_CONTROL dialog %p.\n", g_hwndInitialFocusT1);

        DestroyWindow(hDlg);
    }
}
Exemple #6
0
static void test_timer_message(void)
{
    DialogBoxA(g_hinst, "RADIO_TEST_DIALOG", NULL, timer_message_dlg_proc);
}