CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 3 of 3
  1. #1
    Join Date
    Oct 2008
    Posts
    19

    Question Quitting a Process...

    I'm creating a small, console app to close a running process (utorrent.exe).

    I was wondering how i would go about doing that... TerminateProcess, ExitProcess, some sort of system() control?

    Any input would be appreciated.

  2. #2
    Join Date
    Feb 2009
    Location
    India
    Posts
    444

    Re: Quitting a Process...

    Use TerminateProcess.
    But it is not a clean termination.
    Certain resources held by the process may become corrupt.
    «_Superman
    I love work. It gives me something to do between weekends.

    Microsoft MVP (Visual C++)

  3. #3
    Join Date
    Nov 2000
    Location
    Voronezh, Russia
    Posts
    6,620

    Re: Quitting a Process...

    Quote Originally Posted by patyork View Post
    I'm creating a small, console app to close a running process (utorrent.exe).

    I was wondering how i would go about doing that... TerminateProcess, ExitProcess, some sort of system() control?
    The best way is to go the way a regular user does: send Exit command. Find out the Exit menu item command id and send that command message to the utorrent.exe window. Use Spy++ for finding out the mentioned id value.
    Best regards,
    Igor

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