Switching Windows

Started by
1 comment, last by imadoki 18 years, 1 month ago
Hi, so I am working on this program and when the time comes, the app launches an older app through which the user has to input his or her name, etc. The problem is after it is done, I want to go back to the original app. I tried, SetForegroundWindow, SwitchToThisWindow, but I am failing badly. Basically my question is: I want to store the current topMostWindow, run another app, do something, then set focus back to the previous topMostWindow, how do I do this in plain windows HWND and stuff? Please help.
Advertisement
Yuck! What an ugly design. What is going to keep the user from toggling back to your program before finishing the entry in the other program? I am assuming that your program NEEDS the information from the other program before it can continue any further, so won't your program blow up?

Why can't you simply create a modal window in your program, asking for the values you need? That is a MUCH simpler solution. Heck, you could probably even figure out a way to send that info to the other program and still have something easier to manage than your proposition.

But if you are determined to go the way you are headed, you probably need to investigate hooks, and specifically watch for the program to be destroyed, at which time you would do a 'SetWindowPos' call, or something like it.
This is just a stop gap measure till we roll out our new client/server. The old one was written by 1 programmer who does not work here anymore and half the source code is junk. So, till we roll out the new version, we are in a fix.

This topic is closed to new replies.

Advertisement