So, when the user clicks a button from application A, it fires this executable (see below). This program looks to see if the other application B is running, if so, it switches to application B and puts it in the foreground of the user's session. if application B is not running, it start application B. For this post, i'm only showing the process from A to B. You can simply reuse this code to switch from B to A.
From a windows desktop application, the program interrogates all processes for a particular process name, e.g. "IntuifaceComposer".
If the process exists, the program obtains a window handle and puts the application in the UI's foreground by using a function in dll import, user32.dll, SetForegroundWindow().
Otherwise, if a new application is needed, the program calls the Start method of Process and passes the file location of the application.

No comments:
Post a Comment