在我的程序中有如下代码:
HINSTANCE Ret;//开始切换服务
Ret = ShellExecute(m_hWnd,"open",StrApp1Path,"","",SW_SHOWNORMAL);问题1:如何得到ShellExecute启动的应用程序的进程句柄?
问题2:怎么得到相关的窗口句柄?要求不用查找窗体标题的方法(这样没有普遍性),如FindWindow,EnumWindows等函数.最好直接能从进程得到与其相关的窗体句柄.
HINSTANCE Ret;//开始切换服务
Ret = ShellExecute(m_hWnd,"open",StrApp1Path,"","",SW_SHOWNORMAL);问题1:如何得到ShellExecute启动的应用程序的进程句柄?
问题2:怎么得到相关的窗口句柄?要求不用查找窗体标题的方法(这样没有普遍性),如FindWindow,EnumWindows等函数.最好直接能从进程得到与其相关的窗体句柄.
解决方案 »
- vc如何运用Http协议进行XML数据包的传输
- 一个子网内安装了路由器,网络还能正常吗?
- 创建线程时,如何把数据传到线程处理函数中?附代码
- 征求计算机网络毕设题目
- 再附加弹出菜单是为何出问题?
- 怎么用 WideCharToMultiByte();
- 高分求解,谁能给在下提供有内环和外环形状的按钮的源码(关于这方面的Class)?
- 如何让单文档窗口初始化时最大化?
- ??? 内码转换:GB(K)<--> BIG5 ??????
- 一些小问题,请高手给以解答,谢了先。
- 请教大虾关于使用sock进行红外通讯的问题,就是IrSock的通讯??
- 有没有WINDOWS MEDIA SERVICE SDK 非在线安装的完全版本?
2.FindWindow,再通过GetWindowThreadProcessId验证是否属于你刚才创建的进程
LPSHELLEXECUTEINFO lpExecInfo
);
LPSHELLEXECUTEINFO lpExecInfo
);
typedef struct _SHELLEXECUTEINFO{
DWORD cbSize;
ULONG fMask;
HWND hwnd;
LPCTSTR lpVerb;
LPCTSTR lpFile;
LPCTSTR lpParameters;
LPCTSTR lpDirectory;
int nShow;
HINSTANCE hInstApp;
// Optional members
LPVOID lpIDList;
LPCSTR lpClass;
HKEY hkeyClass;
DWORD dwHotKey;
union {
HANDLE hIcon;
HANDLE hMonitor;
};
HANDLE hProcess;
} SHELLEXECUTEINFO, *LPSHELLEXECUTEINFO;
to:zhaolaoxin(), vcforever(霓裳羽衣)
hInstApp不是返回进程的句柄hInstApp
If the function succeeds, it sets this member to a value greater than 32. If the function fails, it is set to an SE_ERR_XXX error value that indicates the cause of the failure. Although hInstApp is declared as an HINSTANCE for compatibility with 16-bit Windows applications, it is not a true HINSTANCE. It can be cast only to an integer and compared to either 32 or the following SE_ERR_XXX error codes.