Click here to Skip to main content
15,895,084 members
Please Sign up or sign in to vote.
3.00/5 (2 votes)
See more:
Dear friends,
i am sitting with win32 application in vc++ .i want to open a dialog box1 from dialog box2 by using a button in a dialog box2.i am waiting for your valuable answers.
Posted
Comments
[no name] 2-Aug-12 9:20am    
To get "valuable answers" you have to ask a question first. What have you tried? Where is the code that demonstrates your problem?
[no name] 2-Aug-12 9:38am    
And this un-compilable code dump is supposed to ask a question? What exactly is the problem that you are having? And what is the code that you are using that demonstrates that problem?
[no name] 3-Aug-12 7:02am    
Okay so do it. Richard already told you what you need to do.

1 solution

Add another dialog resource to your project and a handler for the button of your first dialog. In your handler call the second dialog. What is the problem exactly?

[edit]
In your dialog handler:
C++
BOOL OnCommand(HWND		hDlg,		// handle to the dialog window
               int		nCmdId,		// ID value of the command entity (Menu or Accelerator)
               HWND		hWndCtl,	// HWND of control window
               UINT		codeNotify	// 0==Menu, 1==Accelerator
               )
{
    // Take action according to nCmdId
    switch (nCmdId)
    {
    case ID_xxx: // to call second dialgo
        DialogBox(GetModuleHandle(NULL), MAKEINTRESOURCE(IDD_DIALOG2), hDlg, (DLGPROC)Dlg2Handler);
        break;

// other command handlers ...

    default:
        // command not handled here
        return FALSE;
    }

    return TRUE;	// for all commands that have been handled
}

LRESULT CALLBACK DlgProc(HWND		hDlg,		// handle to the main dialog window
                         UINT		uMessage,	// windows message code value
                         WPARAM		wParam,		// parameter associated with the message
                         LPARAM		lParam		// parameter associated with the message
                         )
{
    switch (uMessage)
    {
    case WM_INITDIALOG:
        return OnInitDialog(hDlg, (HWND)wParam, lParam);

    case WM_COMMAND:
        return OnCommand(hDlg, LOWORD(wParam), (HWND)lParam, HIWORD(wParam));

    case WM_SYSCOMMAND:
        return OnSysCommand(hDlg, wParam, LOWORD(lParam), HIWORD(lParam));
    }

    return FALSE;
}



[/edit]
 
Share this answer
 
v2
Comments
Richard MacCutchan 3-Aug-12 8:45am    
See above.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900