CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 15 of 15

Threaded View

  1. #1
    Join Date
    Jan 2013
    Posts
    19

    [RESOLVED] Dialogue box button not working

    Dialogue box in the program is displayed but button will not respond.

    I created dialogue box using resource wizard,
    code in Resource.rc for dialogue box is generated as below
    Code:
    IDD_DIALOG1 DIALOGEX 0, 0, 131, 69
    STYLE DS_SETFONT | DS_FIXEDSYS | WS_POPUP | WS_VISIBLE | WS_CAPTION | WS_SYSMENU
    EXSTYLE WS_EX_APPWINDOW
    CAPTION "Test dialogue"
    FONT 8, "MS Shell Dlg", 400, 0, 0x1
    BEGIN
        DEFPUSHBUTTON   "That is Good",IDOK,30,35,66,25
        LTEXT           "Test is successful .",IDC_STATIC,33,15,75,11
    END
    Dialogue box is associated with a menu item by the code

    Code:
    case IDM_ABOUT:
    		CreateDialog(hInst, MAKEINTRESOURCE(IDD_DIALOG1),hwindp, Dialog1Proc);
    		return 0;
    		break;
    message processor for the dialogue box is as below

    Code:
    INT_PTR CALLBACK Dialog1Proc(HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam)
    {
    	
    switch(message)
    	{	case WM_INITDIALOG:
    			return (INT_PTR)TRUE;
    			return a;
    			break;
    
    		case WM_COMMAND:
    		if (LOWORD(wParam) == IDOK)
    		{
    			EndDialog(hDlg, LOWORD(wParam));
    			return (INT_PTR)TRUE;
    		}
    		break;
    
    //		return (INT_PTR) TRUE;
    	}
    
    
    	return (INT_PTR) FALSE;
    
    }
    Adding a case statement IDOK did not help

    Code:
    case IDOK:
    		{
    			EndDialog(hDlg, LOWORD(wParam));
    			return (INT_PTR)TRUE;
    		}
    		break;
    I really need some help at this point, i will be glad if i can get help now.
    Attached Files Attached Files
    Last edited by pavankn18; February 4th, 2013 at 09:52 AM.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured