Connecting Dialog window to main window

This is a discussion on Connecting Dialog window to main window within the Windows Programming forums, part of the Platform Specific Boards category; Hi, I'm having some problem trying to connect my dialog window to my main window. Here's my code: Code: LRESULT ...

  1. #1
    Registered User
    Join Date
    Jul 2007
    Posts
    53

    Connecting Dialog window to main window

    Hi,

    I'm having some problem trying to connect my dialog window to my main window.

    Here's my code:
    Code:
    LRESULT CALLBACK WndProc (HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam)
    {
    	HMENU hMenu;
    	PAINTSTRUCT ps ;
    	static HWND hwnd1;
    	static RECT rect;
    	HDC	hdc;
    
    	static HINSTANCE hInstance;
    
    	switch (message)
    	{
    		case WM_CREATE:
    			hInstance = ((LPCREATESTRUCT) lParam)->hInstance ;
    			return 0;
    		case WM_COMMAND:
    			switch(LOWORD (wParam))
    			{
    				case ID_FILE_EXIT:
    					exit(0);
    					return 0;
    				case ID_FORMAT_TOOLBOX:
    					DialogBox(hInstance, /*TEXT("Toolbox")*/MAKEINTRESOURCE(IDD_PROPPAGE_SMALL), hwnd, ToolBoxDlgProc);
    					return 0;
    			}
    			InvalidateRect (hwnd, NULL, TRUE);
    			return 0;
    		case WM_PAINT :
    			return 0;
    		case WM_DESTROY:
    			PostQuitMessage(0);
    			return 0;
    	}
    
    	return DefWindowProc(hwnd, message, wParam, lParam);
    }
    
    BOOL CALLBACK ToolBoxDlgProc (HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam)
    {
    	switch(message)
    	{
    		case WM_INITDIALOG:
    			return 0;
    		case WM_COMMAND:
    			switch(LOWORD (wParam))
    			{
    				case ID_TOOL_LINE:
    				case ID_TOOL_RECTANGLE: 
    				case ID_TOOL_POLYGON: 
    				case ID_TOOL_ELLIPSE: 
    				case ID_TOOL_SELECT:
    					return true;
    			}
    			return 0;
    	}
    	return 0;
    
    }
    Here's the resource script file
    Code:
    IDD_PROPPAGE_SMALL DIALOGEX 0, 0, 180, 121
    STYLE DS_SETFONT | DS_FIXEDSYS | WS_CHILD | WS_DISABLED | WS_CAPTION | WS_POPUP
    CAPTION "Toolbox"
    FONT 8, "MS Shell Dlg", 0, 0, 0x0
    BEGIN
        GROUPBOX        "ToolBox",IDC_STATIC,7,7,84,107
        PUSHBUTTON      "Colour",IDC_BUTTON1,101,46,59,28
        CONTROL         "Line",IDC_RADIO1,"Button",BS_AUTORADIOBUTTON,14,24,29,10
        CONTROL         "Rectangle",IDC_RADIO2,"Button",BS_AUTORADIOBUTTON,14,42,48,10
        CONTROL         "Polygon",IDC_RADIO3,"Button",BS_AUTORADIOBUTTON,14,60,38,10
        CONTROL         "Ellipse",IDC_RADIO4,"Button",BS_AUTORADIOBUTTON,14,77,38,10
        CONTROL         "Select",IDC_RADIO5,"Button",BS_AUTORADIOBUTTON,14,96,35,10
    END

  2. #2
    train spotter
    Join Date
    Aug 2001
    Location
    near a computer
    Posts
    3,859
    And the exact problem is???

    The symptoms are??

    Your IDE is?
    "Man alone suffers so excruciatingly in the world that he was compelled to invent laughter."
    Friedrich Nietzsche

    "I spent a lot of my money on booze, birds and fast cars......the rest I squandered."
    George Best

    "If you are going through hell....keep going."
    Winston Churchill

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Just starting Windows Programming, School me!
    By Shamino in forum Windows Programming
    Replies: 17
    Last Post: 02-22-2008, 07:14 AM
  2. Dialog window size
    By xkrja in forum Windows Programming
    Replies: 1
    Last Post: 11-22-2006, 05:07 AM
  3. make Child Dialog not Popup?
    By Zeusbwr in forum Windows Programming
    Replies: 5
    Last Post: 04-08-2005, 02:42 PM
  4. Struct *** initialization
    By Saravanan in forum C Programming
    Replies: 20
    Last Post: 10-09-2003, 12:04 PM
  5. problem with open gl engine.
    By gell10 in forum Game Programming
    Replies: 1
    Last Post: 08-21-2003, 04:10 AM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21