CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 3 of 3
  1. #1
    Join Date
    Jan 2000
    Location
    Ohio
    Posts
    2

    Getting a handle to another process

    How do I get a handle to another process (a DOS box) so I can then close it down? I have a VB app that will restart the PC if certain criteria occurs. I am trying to get the handle to this DOS box to then close either by TerminateProcess or sending WM_CLOSE via SendMessage.

    Any ideas.

    Thanks,
    Mike


  2. #2
    Guest

    Re: Getting a handle to another process

    Sorry I don't know any universal methods to do this, but if you know exactly what window you need to close, you can use Spy++ program which comes with Visual Studio. Run it, click on 'Find Window' button, on appeared window click and drag 'Finder Tool' icon over your DOS window. You'll see Window Class parameter for your DOS window. You can use it with PostMessage API with WM_CLOSE constant to kill that DOS Window.
    Vlad


  3. #3

    Re: Getting a handle to another process

    A way to do this automatically from a program would be to import the necessary function for parsing window titles. Things about a dos window is they usually only have the path in the title. Check out MSDN for the needed functions. I think that the codeguru site might also have the needed information.


Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured