shellexecute get handle ?
-
I use function shellexecute (0, "open", "filename", "", "path", SW_SHOW) to execute a program and it runs ok. But I want to get the HWND (handle) of this executed file so that i can hide, minimze, or close it. Please help me how to code (in win32 api) to get the HWND. Thanks.
-
I use function shellexecute (0, "open", "filename", "", "path", SW_SHOW) to execute a program and it runs ok. But I want to get the HWND (handle) of this executed file so that i can hide, minimze, or close it. Please help me how to code (in win32 api) to get the HWND. Thanks.
Hi, You can get HWND for the application you are opening through "ShellExecute" using following technique Psedo code: ShellExecute(GetDesktopWindow(), "open", "filename", "", "path", SW_SHOW) EnumChildWindows(GetDesktopWindow(), CallBackChildWindows, lParam) CallBackChildWindows(...) { int iRet; //Get the class name of the window iRet = GetClassName(hwnd,strClassName,..) if(iRet!=0) { //You must be knowing the class name for the application, which you are //opening through the SheeExecute. So match the class name here, once //match the class name exit from this proc. //arrStrClassNames would have all the class names if(strClassName==arrStrClassNames[iIndex]) return false else return true } } Still facing problems ? :cool: Cheers, Vishal
-
I use function shellexecute (0, "open", "filename", "", "path", SW_SHOW) to execute a program and it runs ok. But I want to get the HWND (handle) of this executed file so that i can hide, minimze, or close it. Please help me how to code (in win32 api) to get the HWND. Thanks.
What about Creating Process using CreateProcess Api,Which give Ultimate Control of Process creating Application to control the new born process. have a look at this article:- http://www.codeproject.com/system/newbiespawn.asp[^]
"Opinions are neither right nor wrong. I cannot change your opinion. I can, however, change what influences your opinion." - David Crow
cheers, Alok Gupta VC Forum Q&A :- I/ IV
-
I use function shellexecute (0, "open", "filename", "", "path", SW_SHOW) to execute a program and it runs ok. But I want to get the HWND (handle) of this executed file so that i can hide, minimze, or close it. Please help me how to code (in win32 api) to get the HWND. Thanks.
Also look at
ShellExecuteEx
instead ofShellExecute