How to pass a window handle to another as command line argument.
-
Hi, I am developing application which is launched by another application. I wanted to notify the parent application (the launcher) that the task successful or failed. So I need to pass the main window handle of the launcher application to my second application like /CallingProgramWindow="0001009C". Then how can i convert the string back to window handle. And is this method is the right way to do this.? I am using VC++ to develop the application. Thanks Nitheesh Nitheesh George http://www.simpletools.co.in
-
Hi, I am developing application which is launched by another application. I wanted to notify the parent application (the launcher) that the task successful or failed. So I need to pass the main window handle of the launcher application to my second application like /CallingProgramWindow="0001009C". Then how can i convert the string back to window handle. And is this method is the right way to do this.? I am using VC++ to develop the application. Thanks Nitheesh Nitheesh George http://www.simpletools.co.in
As far as converting to HWND goes, a handle is really a
void*
, so all you need to do is to parse a HEX number into a void pointer. I do not know if this is the right approach, but I think it has a good chance of working. If it does not work, you could try a less reliable method of passing coordinates of, say, the upper-left corner of the window, and then call WindowFromPoint[^] on it. -
Hi, I am developing application which is launched by another application. I wanted to notify the parent application (the launcher) that the task successful or failed. So I need to pass the main window handle of the launcher application to my second application like /CallingProgramWindow="0001009C". Then how can i convert the string back to window handle. And is this method is the right way to do this.? I am using VC++ to develop the application. Thanks Nitheesh Nitheesh George http://www.simpletools.co.in
While this may work, I am not sure that it is the 'correct' way to implement what you want. It may be better to use the Process functions (
CreateProcess
etc) and use the return value formGetExitCodeProcess()
[^].The best things in life are not things.
-
Hi, I am developing application which is launched by another application. I wanted to notify the parent application (the launcher) that the task successful or failed. So I need to pass the main window handle of the launcher application to my second application like /CallingProgramWindow="0001009C". Then how can i convert the string back to window handle. And is this method is the right way to do this.? I am using VC++ to develop the application. Thanks Nitheesh Nitheesh George http://www.simpletools.co.in
There are several ways to make the two processes communicate. The way you depicted is actually feasible, just use the strtoul[^] function to convert the string. Another simple way would be using the RegisterWindowMessage[^] mechanism. :)
If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler. -- Alfonso the Wise, 13th Century King of Castile.
This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong. -- Iain Clarke
[My articles] -
Hi, I am developing application which is launched by another application. I wanted to notify the parent application (the launcher) that the task successful or failed. So I need to pass the main window handle of the launcher application to my second application like /CallingProgramWindow="0001009C". Then how can i convert the string back to window handle. And is this method is the right way to do this.? I am using VC++ to develop the application. Thanks Nitheesh Nitheesh George http://www.simpletools.co.in
Nitheesh George wrote:
So I need to pass the main window handle of the launcher application to my second application like /CallingProgramWindow="0001009C". Then how can i convert the string back to window handle. And is this method is the right way to do this.?
Unlikely. What exactly do you want to do with the handle in the second app? In general you solve the problem like this. 1. Target app runs 2. Target app gets to point X in app and this is considered 'succcess' 3. Target app 'sends' result to host application. Step 2 is defined by your application. There are several ways to do 3, such as stdio or sockets. However if you just need to know if the target ran and the host ran it then the process of actually running it would tell you that.
-
Hi, I am developing application which is launched by another application. I wanted to notify the parent application (the launcher) that the task successful or failed. So I need to pass the main window handle of the launcher application to my second application like /CallingProgramWindow="0001009C". Then how can i convert the string back to window handle. And is this method is the right way to do this.? I am using VC++ to develop the application. Thanks Nitheesh Nitheesh George http://www.simpletools.co.in
Nitheesh George wrote:
So I need to pass the main window handle of the launcher application to my second application
Mark Salsbery Microsoft MVP - Visual C++ :java: