再问:为什么我用ShellExecuteEx打开一个程序后FindWindow还找不到窗口啊?

yayaniuniu502 2005-09-19 10:43:33
我用以下程序已经可以打开exe文件receiver.exe(我自己写的)
SHELLEXECUTEINFO ShExecInfo = {0};
ShExecInfo.cbSize = sizeof(SHELLEXECUTEINFO);
ShExecInfo.fMask = SEE_MASK_NOCLOSEPROCESS;
ShExecInfo.hwnd = NULL;
ShExecInfo.lpVerb = NULL;
ShExecInfo.lpFile = "c:\\receiver.exe";
ShExecInfo.lpParameters = "";
ShExecInfo.lpDirectory = NULL;
ShExecInfo.nShow = SW_SHOW;
ShExecInfo.hInstApp = NULL;
ShellExecuteEx(&ShExecInfo);
然后我用
HWND hWnd = ::FindWindow(NULL,"Receiver");
怎么找不到窗口啊?
注:我已经设置m_pMainWnd->SetWindowText("Receiver");
我试过sleep(10000)了,不行,不是时间的问题。

...全文
187 6 打赏 收藏 转发到动态 举报
写回复
用AI写文章
6 条回复
切换为时间正序
请发表友善的回复…
发表回复
phisherr 2005-09-26
  • 打赏
  • 举报
回复
你是不是把ShExecInfo.fMask的属性设置成了SEE_MASK_NO_CONSOLE
yayaniuniu502 2005-09-19
  • 打赏
  • 举报
回复
哦,找到了,类名是 AfxFrameOrView70d ,但是添加进去还是不行,郁闷!
yayaniuniu502 2005-09-19
  • 打赏
  • 举报
回复
但是每次打开的窗口id都不一样啊
howtotell 2005-09-19
  • 打赏
  • 举报
回复
HWND hWnd = ::FindWindow(NULL,"Receiver");
第一个参数,"类名“也填上。(用spy++可以找到)
yayaniuniu502 2005-09-19
  • 打赏
  • 举报
回复
还是不行,请教
ShellExecute(hWnd,"open","C:\\Documents and Settings\\Administrator\\桌面\\86days\\receiver1\\receiver1\\Debug\\receiver1.exe",0,0,2);
怎么传参啊?

15,471

社区成员

发帖
与我相关
我的任务
社区描述
VC/MFC 进程/线程/DLL
社区管理员
  • 进程/线程/DLL社区
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧