您的位置:首页 > 运维架构

Frame_GetWindow(::GetDesktopWindow(), GW_CHILD)

2013-05-23 08:18 721 查看
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
}
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: