Sign in to follow this  
imadoki

Switching Windows

Recommended Posts

imadoki    122
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.

Share this post


Link to post
Share on other sites
Guest Anonymous Poster   
Guest Anonymous Poster
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.

Share this post


Link to post
Share on other sites
imadoki    122
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.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this