Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

retaining focus

Status
Not open for further replies.

NiceButDim

Programmer
Feb 12, 2002
154
GB
I want to startup another program from within mine, but I want my program to retain focus. At the moment, as soon as I start up the second program it takes the focus.
Anyone got any ideas of how to do what I want to do?
 
Hi!

This very strong depends on the type of Application you are about to start and how you start it. If you want best controll over the Application, use CreateProcess() to start it. There you have a lot of options to hide the started application. If this app doesnt ignore these Options.

If you need to wait for the App to be finished with watever it has to do, use WaitForSingleObject with the handle of the new created Process. A while loop containing Sleep(0) does everything a Multitasking OS needs.

Greetings
Remo
 
The app I want to run is something that will play a MP3 file (media player possibly).
I will have a look at CreateProcess().
Thanks for your help.
 
Hi again!

If you want to run Media Player, why dont you use an ActiveX Controll embedded into one of your resources? Then you have the best controll over everything.

Greetings
Remo
 
Sounds good, though I know almost nothing about ActiveX.
I will look into it.
Thanks again.
 
If you use VisualStudio Resources Editor you can for Example include an ActiveX into a Dialog. This can be invisible if necessary. But the important part is, VS makes a header File for you, to controll this ActiveX. Its nearly like using any other Class.

Greetings
Remo
 
I just added a media player control to my project!
Looks like you've pointed me in the direction of a much better solution to my problem.

Thanks a lot.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top