我正在尝试使用DialogBoxParam来创建使用VC6.0的模式对话框。但是新对话框不是模态的,因为在新对话框加速后,后面的对话框仍然可以点击。在google和stackoverflow上搜索解决方案后,我没有任何线索。
代码:
if(lParam->code == NM_DBLCLK)
{
HINSTANCE hInstance = (HINSTANCE)GetWindowLong(hwnd,GWL_HINSTANCE);
//hwnd is current dialogbox which is the parent of the new dialogbox
int retCode = DialogBoxParam(hInstance, MAKEINTRESOURCE(IDD_DIALOG_ADDM), hwnd, AddMember_Proc,(LPARAM)&sdata);
新对话框的资源定义:
IDD_DIALOG_ADDM DIALOG DISCARDABLE 0, 0, 374, 240
STYLE DS_MODALFRAME | DS_CENTER | WS_POPUP | WS_CAPTION | WS_SYSMENU
任何人都知道吗?
修改
BOOL WINAPI AddMember_Proc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
{
switch(uMsg)
{
HANDLE_MSG(hWnd, WM_INITDIALOG, AddMember_OnInitDialog);
HANDLE_MSG(hWnd, WM_COMMAND, AddMember_OnCommand);
HANDLE_MSG(hWnd,WM_CLOSE, AddMember_OnClose);
}
return FALSE;
}