当前位置: 代码迷 >> WinCE >> ShellExecuteEx启动A.exe,然后A.exe最小化隐藏,请教怎么能让A.exe界面显示出来
  详细解决方案

ShellExecuteEx启动A.exe,然后A.exe最小化隐藏,请教怎么能让A.exe界面显示出来

热度:78   发布时间:2016-04-28 13:12:45.0
ShellExecuteEx启动A.exe,然后A.exe最小化隐藏,请问如何能让A.exe界面显示出来
如题

FindWindow(null,Text("A"))找不到A程序的窗口句柄

------解决方案--------------------
第二个参数是程序的窗口标题 

C/C++ code
CWnd::FindWindow This   method   retrieves   the   top-level   CWnd   whose   window   class   is   specified   by   lpszClassName   and   whose   window   name,   or   title,   is   specified   by   lpszWindowName.   This   method   does   not   search   child   windows. static   CWnd*   PASCAL   FindWindow(   LPCTSTR   lpszClassName,   LPCTSTR   lpszWindowName   );   Parameters lpszClassName   Points   to   a   null-terminated   string   that   specifies   the   window   class   name,   a   WNDCLASS   structure.   If   the   lpClassName   parameter   is   NULL,   then   all   class   names   result   as   a   successful   match.   lpszWindowName   Points   to   a   null-terminated   string   that   specifies   the   window   name,   the   window   title.   If   the   lpWindowName   parameter   is   NULL,   then   all   window   names   result   as   a   successful   match.   Return   Value Identifies   the   window   that   has   the   specified   class   name   and   window   name.   It   is   NULL   if   no   such   window   is   found.   The   CWnd*   may   be   temporary   and   should   not   be   stored   for   later   use. Example //   Activate   an   application   with   a   window   with   a   specific   class   name.         BOOL   COneT32App::FirstInstance()         {             CWnd   *pWndPrev,   *pWndChild;             //   Determine   if   a   window   with   the   class   name   exists...             if   (pWndPrev   =   CWnd::FindWindow(_T( "MyNewClass "),NULL))             {                 //   If   so,   does   it   have   any   popups?                 pWndChild   =   pWndPrev-> GetLastActivePopup();                 //   If   iconic,   restore   the   main   window.                 if   (pWndPrev-> IsIconic())                     pWndPrev-> ShowWindow(SW_RESTORE);                 //   Bring   the   main   window   or   its   popup   to   the   foreground                 pWndChild-> SetForegroundWindow();                 //   and   you   are   done   activating   the   other   application.                 return   FALSE;             }         }