Jump to content
  • Advertisement
Sign in to follow this  
Boonio

[.net] Multiple Processes and Hidden Windows

This topic is 3315 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Hi, I'm trying to write a little C# program which opens up multiple command line applications. The application I am trying to run uses the window title/caption to update its progress (as a percentage). I'm currently just using multiple instances of Process to do this. I want to open up around 8 of these applications all running simultaneously with all the windows hidden. I then want to be able to pull the captions/text from each individual window and use them to update a progress bar on a windows form or whatever. The problems is that I am unable to pull the window title from the windows when they are hidden. Would this even be possible at all with a changing window title/caption on a hidden window? I've tried GetWindowText() and using the Process.MainWindowTitle but they aren't returning anything. Hope that makes sense. Thanks.

Share this post


Link to post
Share on other sites
Advertisement
In unmanaged code you can get the title of a hidden console window by calling AttachConsole() on the console window's process id followed by GetConsoleTitle() and FreeConsole(). I don't know if AttachConsole()/FreeConsole() have .NET equivalents, but P/Invoking them shouldn't be a problem since they have very simple function signatures. Reading from Console.Title should be the equivalent of calling GetConsoleTitle(). Also, I believe this technique only works on XP and later.

Share this post


Link to post
Share on other sites
In .NET there is no way to enumerate open window titles. But you can PInvoke it extremely easily. Once you have that you will be well on you way on finding the required captions and extracting the requisite percentages.

Share this post


Link to post
Share on other sites
The AttachConsole()/GetConsoleTitle() works perfectly.

Thanks for the help Guys. Much appreciated.

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!