Thread: Dialog not opening...

  1. #1
    Registered User
    Join Date
    Oct 2002
    Posts
    18

    Unhappy Dialog not opening... (Reviewed)

    Okay, I checked what was wrong and tried adding different objects to the dialog.. it seems that when I add Common Controls such as progress bars or listviews, the dialog does not show. However, all other objects such as buttons, picture boxes and check boxes do not make any difference.. Is there anything I'm missing?? Here's the code:

    Code:
    #include <windows.h>
    #include "resource.h"
    #include <commctrl.h>
    
    BOOL MainDialog_OnCommand(HWND hWnd, WORD wCommand, WORD wNotify, HWND hControl);
    BOOL MainDialogProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam);
    
    int WINAPI WinMain(HINSTANCE, HINSTANCE, LPSTR, int) { 
    	DialogBoxParam(GetModuleHandle(NULL),MAKEINTRESOURCE(IDD_DIALOG1),NULL,(DLGPROC)MainDialogProc,0); 
    	return 0; 
    }
    BOOL MainDialogProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
    {
    	switch (uMsg)
    	{
    	case WM_COMMAND:
    		return MainDialog_OnCommand(hWnd, LOWORD(wParam), HIWORD(wParam), (HWND)lParam);
    		break;
    	case WM_CLOSE:
    		EndDialog(hWnd,0);
    		return TRUE;
    	}
    	return FALSE;
    }
    BOOL MainDialog_OnCommand(HWND hWnd, WORD wCommand, WORD wNotify, HWND hControl)
    {
    	switch (wCommand)
    	{
    	case IDOK:
    	case IDCANCEL:
    		EndDialog(hWnd,0);
    		return TRUE;
    	}
    	return TRUE;
    }
    Last edited by void; 10-19-2002 at 05:20 PM.
    ~void

  2. #2
    Seeking motivation... endo's Avatar
    Join Date
    May 2002
    Posts
    537
    Why dont people like MFC?? mydialg.DoModal( ) is so much easier.....

    Sorry, cant really help but felt the need to say something
    Couldn't think of anything interesting, cool or funny - sorry.

  3. #3
    Registered User
    Join Date
    Oct 2002
    Posts
    18
    bah, nobody has ANY ideas WHATSOEVER!?!?!
    At least tell me something like "No, you're screwed." ;x

    PS: No, I did not mean that
    ~void

  4. #4
    It's full of stars adrianxw's Avatar
    Join Date
    Aug 2001
    Posts
    4,829
    I don't have time to play with your code right now, and your style is a little "unusual", but no matter. I can't see a call to InitCommonControls() anywhere.
    Wave upon wave of demented avengers march cheerfully out of obscurity unto the dream.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. make Child Dialog not Popup?
    By Zeusbwr in forum Windows Programming
    Replies: 5
    Last Post: 04-08-2005, 02:42 PM
  2. Having Trouble Opening My Dialog Box
    By ElWhapo in forum Windows Programming
    Replies: 8
    Last Post: 12-28-2004, 12:13 PM
  3. Getting the position of a dialog without parent on the screen
    By stormbringer in forum Windows Programming
    Replies: 1
    Last Post: 08-27-2003, 02:59 AM
  4. opening a dialog window from inside a dialog window
    By uvacow in forum C++ Programming
    Replies: 1
    Last Post: 12-02-2002, 09:27 AM
  5. Tab Controls - API
    By -KEN- in forum Windows Programming
    Replies: 7
    Last Post: 06-02-2002, 09:44 AM