|
阅读:1806回复:0
WCE下窗口切换
小弟我最近在测个功能.我们在GPS应用程序.由我们的程序创建了一个新的进程也就是地图导航软件.这时有个硬件开关.我想在按的时候能够切换回我们的应用程序.再按下又返回到地图软件.可是老是实现不了.
注:这个硬件开关在GPS应用程序里可以返回到主窗口界面.就是在GPS里不论你在那个窗口界面只要按下这个按键都能返回到主界面. void CMyShellDlg::FromGpsToMain()
{
PidAndWnd temp;
temp.dwProcessId=GpsProcessInfo.dwProcessId;
EnumWindows(EnumWindowsProcGetWndTitle,(long)(&temp));
::ShowWindow(temp.hWnd,SW_HIDE);
CWnd * pWnd;
pWnd=GetActiveWindow();
if(pWnd)
pWnd->SetForegroundWindow();
m_iNeedRefresh=1;
}这是隐藏代码 if(GpsProcessInfo.hProcess)
{
PidAndWnd temp;
temp.dwProcessId=GpsProcessInfo.dwProcessId;
EnumWindows(EnumWindowsProcGetWndTitle,(long)(&temp));
if(temp.hWnd)
{
::SetForegroundWindow(temp.hWnd);
int screenx=GetSystemMetrics(SM_CXSCREEN);
int screeny=GetSystemMetrics(SM_CYSCREEN);
::SetWindowPos(temp.hWnd,HWND_TOP,0,0,screenx,screeny,SWP_SHOWWINDOW);
::ShowWindow(temp.hWnd,SW_SHOW);
SetRespond();
return;
}
}这是显示代码. 现在能隐藏了.可是再点GPS图标却不能显示刚才隐藏的进程. |
|