使用CreateWindowEx创建一个仅消息窗口 [英] Using CreateWindowEx to Make a Message-Only Window
本文介绍了使用CreateWindowEx创建一个仅消息窗口的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我尝试使用 CreateWindowEx
生成一个仅消息窗口:
I'm trying to use CreateWindowEx
to generate a message-only window:
_hWnd = CreateWindowEx( 0, NULL, NULL, 0, 0, 0, 0, 0, HWND_MESSAGE, NULL, NULL, NULL );
当我的应用程序执行此行时,它总是返回 _hWnd = 0
。我做错了什么?我使用Visual Studio 2008.(是吗?j / k)谢谢。
When my application executes this line it always returns _hWnd = 0
. What am I doing wrong? I'm using Visual Studio 2008. (Is that it? j/k) Thanks.
推荐答案
lpClassName
不应为 NULL
。使用 RegisterClassEx
函数注册类并将其传递给 CreateWindowEx
。
lpClassName
shouldn't be NULL
. Register class using RegisterClassEx
function and pass it to CreateWindowEx
.
static const char* class_name = "DUMMY_CLASS";
WNDCLASSEX wx = {};
wx.cbSize = sizeof(WNDCLASSEX);
wx.lpfnWndProc = pWndProc; // function which will handle messages
wx.hInstance = current_instance;
wx.lpszClassName = class_name;
if ( RegisterClassEx(&wx) ) {
CreateWindowEx( 0, class_name, "dummy_name", 0, 0, 0, 0, 0, HWND_MESSAGE, NULL, NULL, NULL );
}
这篇关于使用CreateWindowEx创建一个仅消息窗口的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文