Thread: Problem creating a Dialog Box

Threaded View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Darkness Prevails Dark_Phoenix's Avatar
    Join Date
    Oct 2006
    Location
    Houston, Texas
    Posts
    174

    Problem creating a Dialog Box

    This is giving me an error 'Invalid Window Handle' but I can't figure out why.

    Code:
    LRESULT CALLBACK MainWinProc(HWND hWnd, UINT Msg, WPARAM wParam, LPARAM lParam)
    {
        switch (Msg)
        {
            case WM_CREATE:
            {
                char str[80];
                if (DialogBoxParam(GetModuleHandle(NULL),
                                   MAKEINTRESOURCE(IDD_NEWUSER),
                                   hWnd,
                                   NewUserDlgProc,
                                   (LPARAM)str) <= 0)
                {
                    ShowWinError();
                }
            }
            break;
     
            case WM_CLOSE:
            DestroyWindow(hWnd);
            break;
     
            case WM_DESTROY:
            PostQuitMessage(0);
            break;
     
            default:
            return DefWindowProc (hWnd, Msg, wParam, lParam);
        }
        return 0;
    }
    I am tring to opn a dialog for the user to enter a user name and have the dialog pass that back to the main window

    The call to DialogBoxParam is throwing the invalid handle error. Any ideas?
    Last edited by Dark_Phoenix; 05-30-2009 at 07:20 AM.
    Using Code::Blocks and Windows XP

    In every hero, there COULD be a villain!

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Problem with Dialog Box
    By KonArtis in forum Windows Programming
    Replies: 3
    Last Post: 01-04-2005, 02:28 PM
  2. the open box problem
    By Brian in forum A Brief History of Cprogramming.com
    Replies: 8
    Last Post: 02-28-2003, 05:53 AM
  3. dialog box
    By JaWiB in forum Windows Programming
    Replies: 0
    Last Post: 02-21-2003, 10:24 PM
  4. Dialog box
    By DeanaM in forum Windows Programming
    Replies: 3
    Last Post: 10-16-2002, 12:04 PM
  5. Dialog Box Problem....
    By minime6696 in forum Windows Programming
    Replies: 2
    Last Post: 01-08-2002, 08:24 PM