问题描述
我正在尝试为我的无模式对话框创建自定义类名称.
下面显示了我的.rc文件中的代码片段以及创建代码
对话框.一切正常,直到我返回了NULL句柄
与CreateDialog(据我所知,它是
的包装器)CreateWindowEx). GetLastError为ERROR_SUCCESS.我不是
了解我在这里做错了.
IDRESULTS DIALOGEX 0、0、412、232
样式DS_SETFONT | DS_MODALFRAME | DS_FIXEDSYS | WS_MINIMIZEBOX |
WS_POPUP | WS_CAPTION | WS_SYSMENU
精美WS_EX_CONTROLPARENT
CAPTION结果"
CLASS"MyClass"
字体8,"MS Shell Dlg",400,0,0x1
开始
HWND hwndDlg = NULL;
WNDCLASSEX wcx;
if(!GetClassInfoEx(hInst,#32770",& wcx))
ErrorExit(TEXT("GetClassInfoEx"));
wcx.lpfnWndProc = DlgResultsProc;
wcx.cbSize = sizeof(wcx);
wcx.lpszClassName ="MyClass";
if(!RegisterClassEx(& wcx))
ErrorExit(TEXT("RegisterClassEx"));
//创建一个无模型(非阻塞对话框)
hwndDlg =(HWND)CreateDialog(hInst,
MAKEINTRESOURCE(IDRESULTS),
hwnd,//这是拥有它的主窗口的句柄
DlgResultsProc); //指向对话框过程的指针
if(hwndDlg == NULL)
ErrorExit(TEXT("CreateDialog"));
ShowWindow(hwndDlg,SW_SHOW); //使窗口可见
UpdateWindow(hwnd); //重新绘制窗口
return hwndDlg;
I''m trying to create a custom class name for my modeless dialog box.
The following shows a snippet from my .rc file and the code to create
the dialog. Everything works fine until I get a NULL handle returned
with CreateDialog (which I understand to be a wrapper for
CreateWindowEx). The GetLastError is ERROR_SUCCESS. I''m not
understanding what I''m doing wrong here.
IDRESULTS DIALOGEX 0, 0, 412, 232
STYLE DS_SETFONT | DS_MODALFRAME | DS_FIXEDSYS | WS_MINIMIZEBOX |
WS_POPUP | WS_CAPTION | WS_SYSMENU
EXSTYLE WS_EX_CONTROLPARENT
CAPTION "Results"
CLASS "MyClass"
FONT 8, "MS Shell Dlg", 400, 0, 0x1
BEGIN
HWND hwndDlg = NULL;
WNDCLASSEX wcx;
if(!GetClassInfoEx(hInst,"#32770",&wcx))
ErrorExit(TEXT("GetClassInfoEx"));
wcx.lpfnWndProc = DlgResultsProc;
wcx.cbSize = sizeof(wcx);
wcx.lpszClassName = "MyClass";
if(!RegisterClassEx(&wcx))
ErrorExit(TEXT("RegisterClassEx"));
//create a modless (non-blocking dialog box)
hwndDlg = (HWND)CreateDialog(hInst,
MAKEINTRESOURCE(IDRESULTS),
hwnd, //this is the handle to the main window that owns it
DlgResultsProc); //pointer to dialog box procedure
if(hwndDlg == NULL)
ErrorExit(TEXT("CreateDialog"));
ShowWindow(hwndDlg,SW_SHOW); // Make the window visible
UpdateWindow(hwnd); //redraw the window
return hwndDlg;
推荐答案
这篇关于帮助创建自定义类无模式对话框的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!