通过使用另一个对话框中的按钮来调用一个对话框 [英] call a dialog box by using a button in another dialogbox
本文介绍了通过使用另一个对话框中的按钮来调用一个对话框的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
亲爱的朋友,
我坐在vc ++中的Win32应用程序中.我想通过使用对话框2中的按钮从对话框2中打开对话框.我正在等待您的宝贵答复.
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.
推荐答案
将另一个对话框资源添加到您的项目中,并为第一个对话框的按钮添加一个处理程序.在您的处理程序中,调用第二个对话框.到底是什么问题?
[edit]
在对话框处理程序中:
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:
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]
[/edit]
这篇关于通过使用另一个对话框中的按钮来调用一个对话框的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文