以下是MSDN中关于AfxGetMainWnd的介绍: If AfxGetMainWnd is called from the application's primary thread, it returns the application's main window according to the above rules. If the function is called from a secondary thread in the application, the function returns the main window associated with the thread that made the call. 也许在线程中调用该函数就行了,不过我没试过。另外建议你多研究一下MSDN文档,很多问题都能在里面找到答案。
If AfxGetMainWnd is called from the application's primary thread, it returns the application's main window according to the above rules. If the function is called from a secondary thread in the application, the function returns the main window associated with the thread that made the call.
也许在线程中调用该函数就行了,不过我没试过。另外建议你多研究一下MSDN文档,很多问题都能在里面找到答案。
{
int retValue = 0;
HWND hDlg = reintepret_cast<HWND>(thisHwnd);
SendMessage(hDlg,WM_MY,0,0);
...省略掉了}