CreateWindow在_beginthreadex创建的线程中失败

时间:2013-11-19 10:51:01

标签: c++ multithreading createwindow

我有一个线程函数,我从该线程创建一个窗口

每当我使用CreateThread() API创建我的线程时,CreateWindow()返回true并创建窗口,但是如果我使用_beginthreadex创建我的线程,CreateWindow()将返回false并且它不会创建窗口

这是我创建线程的方式:

使用CreateThread()

// My Thread Function : HRESULT WINAPI CreateWndForHotkey(LPVOID)
CreateThread(NULL,NULL,(LPTHREAD_START_ROUTINE)CreateWndForHotkey,NULL,NULL,NULL);

使用_beginthreadex()

// My Thread Function : unsigned WINAPI CreateWndForHotkey(LPVOID)
_beginthreadex(NULL, 0, &CreateWndForHotkey, NULL, 0, NULL);

0 个答案:

没有答案