Stop Program

This is a discussion on Stop Program within the Windows Programming forums, part of the Platform Specific Boards category; Hi I have a program that runs but when i press a certian key command i want the whole program ...

  1. #1
    Is Trying to Learn
    Join Date
    Mar 2006
    Location
    Hutton, Preston
    Posts
    215

    Stop Program

    Hi

    I have a program that runs but when i press a certian key command i want the whole program to end.

    at the moment it just closes the window

    can anyone help how to terminate the whole program?

    Thanks

  2. #2
    Reverse Engineer maxorator's Avatar
    Join Date
    Aug 2005
    Location
    Estonia
    Posts
    2,318
    ExitProcess(1);
    "The Internet treats censorship as damage and routes around it." - John Gilmore

  3. #3
    Is Trying to Learn
    Join Date
    Mar 2006
    Location
    Hutton, Preston
    Posts
    215
    Hi

    i have used that and it doesnt end my program but causes a problem when it ends.

    this is the code i am using

    Code:
              case VK_ESCAPE:
    		// If the user press Ctrl + Alt + Delete
    		if( VK_ESCAPE &&Shift.Contains(ssCtrl&& ssAlt ))
                    break;
    	}
            ExitProcess(1);}

  4. #4
    Kernel hacker
    Join Date
    Jul 2007
    Location
    Farncombe, Surrey, England
    Posts
    15,677
    Describe in more detail what happens.

    --
    Mats
    Compilers can produce warnings - make the compiler programmers happy: Use them!
    Please don't PM me for help - and no, I don't do help over instant messengers.

  5. #5
    Is Trying to Learn
    Join Date
    Mar 2006
    Location
    Hutton, Preston
    Posts
    215
    it pauses the program opens the CPU box and says that there is a "access violation"

  6. #6
    Kernel hacker
    Join Date
    Jul 2007
    Location
    Farncombe, Surrey, England
    Posts
    15,677
    There are a number of conditions with the application of ExitProcess()

    http://msdn2.microsoft.com/en-us/library/ms682658.aspx

    Is there any reason you can't use exit(1) from stdlib.h?

    --
    Mats
    Compilers can produce warnings - make the compiler programmers happy: Use them!
    Please don't PM me for help - and no, I don't do help over instant messengers.

  7. #7
    Is Trying to Learn
    Join Date
    Mar 2006
    Location
    Hutton, Preston
    Posts
    215
    that exit(1) from stdlib.h worked thanks

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Early program stop problem
    By bmb_ksu in forum C Programming
    Replies: 9
    Last Post: 02-19-2006, 09:24 AM
  2. Replies: 3
    Last Post: 03-04-2005, 02:46 PM
  3. I need some help with my program please.
    By agentxx04 in forum C Programming
    Replies: 9
    Last Post: 09-26-2004, 08:51 AM
  4. continuing program until ready to stop
    By jlmac2001 in forum C++ Programming
    Replies: 2
    Last Post: 01-19-2003, 07:19 PM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21