Click here to Skip to main content
13,590,079 members
Rate this:
Please Sign up or sign in to vote.
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 2-Aug-12 3:17am
Wes Aday 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?
Wes Aday 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?
Wes Aday 3-Aug-12 7:02am
Okay so do it. Richard already told you what you need to do.

1 solution

Rate this: bad
Please Sign up or sign in to vote.

Solution 2

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?

In your dialog handler:
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);

// other command handlers ...

        // 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)
        return OnInitDialog(hDlg, (HWND)wParam, lParam);

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

        return OnSysCommand(hDlg, wParam, LOWORD(lParam), HIWORD(lParam));

    return FALSE;

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)

  Print Answers RSS
Top Experts
Last 24hrsThis month

Advertise | Privacy | Cookies | Terms of Service
Web03-2016 | 2.8.180618.1 | Last Updated 3 Aug 2012
Copyright © CodeProject, 1999-2018
All Rights Reserved.
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100