本文介紹了使用 CreateWindowEx 制作僅消息窗口的處理方法,對大家解決問題具有一定的參考價(jià)值,需要的朋友們下面隨著小編來一起學(xué)習(xí)吧!
問題描述
我正在嘗試使用 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 );
當(dāng)我的應(yīng)用程序執(zhí)行這一行時(shí),它總是返回 _hWnd = 0
.我做錯(cuò)了什么?
When my application executes this line it always returns _hWnd = 0
. What am I doing wrong?
推薦答案
lpClassName
不應(yīng)為 NULL
.使用RegisterClassEx
函數(shù)注冊類并將其傳遞給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 );
}
這篇關(guān)于使用 CreateWindowEx 制作僅消息窗口的文章就介紹到這了,希望我們推薦的答案對大家有所幫助,也希望大家多多支持html5模板網(wǎng)!
【網(wǎng)站聲明】本站部分內(nèi)容來源于互聯(lián)網(wǎng),旨在幫助大家更快的解決問題,如果有圖片或者內(nèi)容侵犯了您的權(quán)益,請聯(lián)系我們刪除處理,感謝您的支持!