BOOL CMyTestApp::InitInstance()
{
CHAR CurrentWinTitle[MAX_PATH];
CWnd *pCurrentWindow = NULL;
HWND hCurrentWindow = NULL; pCurrentWindow=AfxGetMainWnd();
hCurrentWindow=pCurrentWindow->GetSafeHwnd();
::GetWindowText(hCurrentWindow,CurrentWinTitle,MAX_PATH);
AfxMessageBox(CurrentWinTitle); ......
}请问这段代码执行后为什么取不到主窗口的指针啊,总是返回0x000000有什么需要注意的吗?谢谢!
{
CHAR CurrentWinTitle[MAX_PATH];
CWnd *pCurrentWindow = NULL;
HWND hCurrentWindow = NULL; pCurrentWindow=AfxGetMainWnd();
hCurrentWindow=pCurrentWindow->GetSafeHwnd();
::GetWindowText(hCurrentWindow,CurrentWinTitle,MAX_PATH);
AfxMessageBox(CurrentWinTitle); ......
}请问这段代码执行后为什么取不到主窗口的指针啊,总是返回0x000000有什么需要注意的吗?谢谢!
解决方案 »
免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货