void CMainFrame::OnFrameIsWindow()
{
// TODO: Add your command handler code here
//
HWND hWnd=this->GetSafeHwnd();
if(::IsWindow(hWnd)) //估计Frame会被认为属于Window,而View不会被认为属于Window.
{
MessageBox("yes");
}
else
{
MessageBox("no");
}
//看一看遍历得到不?
// 寻找先前实例的主窗口
HWND hWndPrevious = ::GetWindow(::GetDesktopWindow(), GW_CHILD);
while (::IsWindow(hWndPrevious))
{
if (hWndPrevious==hWnd)
{
MessageBox("get it !");
return ;
}
// 继续寻找下一个窗口
hWndPrevious = ::GetWindow(hWndPrevious, GW_HWNDNEXT);
}
MessageBox("can't get it !");
//看一看遍历得到不?end
}
void CIsWindowView::OnViewIsWindow()
{
// TODO: Add your command handler code here
//
HWND hWnd=this->GetSafeHwnd();
if(::IsWindow(hWnd)) //估计Frame会被认为属于Window,而View不会被认为属于Window.
{
MessageBox("yes");
}
else
{
MessageBox("no");
}
//看一看遍历得到不?
// 寻找先前实例的主窗口
HWND hWndPrevious = ::GetWindow(::GetDesktopWindow(), GW_CHILD);
while (::IsWindow(hWndPrevious))
{
if (hWndPrevious==hWnd)
{
MessageBox("get it !");
return ;
}
// 继续寻找下一个窗口
hWndPrevious = ::GetWindow(hWndPrevious, GW_HWNDNEXT);
}
MessageBox("can't get it !");
//看一看遍历得到不?end
}