CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 4 of 4
  1. #1
    Join Date
    May 2012
    Posts
    4

    If there a way to close an application?

    I should note first of all, im not a good c# programmer, but im trying!

    Is there a way that i can 'get' an application that is currently active?
    E.i.. i open chrome, while chrome is on to, can i close from within a windows form application?

    Im using the speech api, and have got as far as the ocmputer registering what i say, and getting it to check if i said "Close application" isn't a problem. But when i say "close application", How do i get it to close chrome?

    Thanks

  2. #2
    Join Date
    Oct 2011
    Posts
    97

    Re: If there a way to close an application?

    A quick Google search would have given you the answer you are looking for:

    http://support.microsoft.com/kb/305603

  3. #3
    Join Date
    May 2012
    Posts
    4

    Re: If there a way to close an application?

    Yeah, i saw that, it's great if i know the PID and application name.. but what if i don't?

    I want to be able to close any application that is active, not just chrome

  4. #4
    Join Date
    Oct 2011
    Posts
    97

    Re: If there a way to close an application?

    Use the GetForegroundWindow function from the the Windows API.

    http://msdn.microsoft.com/en-us/libr...(v=vs.85).aspx

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