[RESOLVED] Why this dialog isn't caused?
CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 6 of 6

Thread: [RESOLVED] Why this dialog isn't caused?

  1. #1
    Join Date
    Feb 2012
    Posts
    181

    [RESOLVED] Why this dialog isn't caused?

    Code:
    INT_PTR CALLBACK MyInputDlgProc(HWND hDlg, UINT iMsg, WPARAM wParam, LPARAM lParam)
    {
        switch(iMsg)
        {
            case WM_COMMAND:
                switch(LOWORD(wParam))
                {
                    case IDOK:
                     WCHAR Temp[256];
                     GetDlgItemText(hDlg, IDC_EDIT1, Temp, 50);
    				 CharToOem(Temp, TempName);
                     EndDialog(hDlg, FALSE);
    				 break;
    				case IDCLOSE:
                     EndDialog(hDlg, FALSE);
                     break;
                }
            case WM_DESTROY:
                DestroyWindow(hDlg);
                break;
            default:
                return FALSE;
        }
        return TRUE;
    }
    ....
    CreateDialog(hInst, MAKEINTRESOURCE(IDD_INPUTBOX), hWnd, MyInputDlgProc); // this is simplisity passed

  2. #2
    VictorN's Avatar
    VictorN is online now Super Moderator Power Poster
    Join Date
    Jan 2003
    Location
    Wallisellen (ZH), Switzerland
    Posts
    17,352

    Re: Why this dialog isn't caused?

    Define "isn't caused".
    Victor Nijegorodov

  3. #3
    Join Date
    Feb 2012
    Posts
    181

    Re: Why this dialog isn't caused?

    VictorN, isn't invoked, correctly...

  4. #4
    Join Date
    Oct 2006
    Location
    Sweden
    Posts
    3,632

    Re: Why this dialog isn't caused?

    See http://msdn.microsoft.com/en-us/libr...(v=vs.85).aspx
    If CreateDialog returns NULL call GetLastError to find out why
    Debugging is twice as hard as writing the code in the first place.
    Therefore, if you write the code as cleverly as possible, you are, by
    definition, not smart enough to debug it.
    - Brian W. Kernighan

    To enhance your chance's of getting an answer be sure to read
    http://www.codeguru.com/forum/announ...nouncementid=6
    and http://www.codeguru.com/forum/showthread.php?t=366302 before posting

    Refresh your memory on formatting tags here
    http://www.codeguru.com/forum/misc.php?do=bbcode

    Get your free MS compiler here
    http://www.microsoft.com/visualstudio/eng/downloads

  5. #5
    Join Date
    Feb 2012
    Posts
    181

    Re: Why this dialog isn't caused?

    DialogBox is needed. Solved.

  6. #6
    Join Date
    Nov 2000
    Location
    Voronezh, Russia
    Posts
    5,957

    Re: Why this dialog isn't caused?

    Quote Originally Posted by AKE View Post
    DialogBox is needed. Solved.
    It actually depends on what the purpose was. DialogBox creates modal dialog when CreateDialog creates modeless one.

    Code:
    HWND hDlg = CreateDialog(...);  // this just creates dialog window
    ShowWindow(hDlg, SW_SHOW); // unless WS_VISIBLE was specified at creation
    UpdateWindow(hDlg);
    
    // message pump is also needed running on this thread
    Best regards,
    Igor

Posting Permissions

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


Azure Activities Information Page

Windows Mobile Development Center


Click Here to Expand Forum to Full Width

This is a CodeGuru survey question.


Featured


HTML5 Development Center