Thread: Detect the system being shut down or restarted.

  1. #1
    Registered User Queatrix's Avatar
    Join Date
    Apr 2005
    Posts
    1,342

    Detect the system being shut down or restarted.

    How can I make a program detect if the computer is being shut down? That way I can make my editor save it's data before the system closes it.

    Thanks, August.

  2. #2
    Registered User
    Join Date
    Nov 2002
    Posts
    491
    Since C++ has no concep tof this you are going to have to provide some information in terms of your operating system. In UNIX you get a SIGTERM when yoru application is being shutdown, on windows you get a WM_SOMETHINGOROTHER. Obviously these are quite different. If you are using windows your question is more suited in the Windows forum.

  3. #3
    Skunkmeister Stoned_Coder's Avatar
    Join Date
    Aug 2001
    Posts
    2,572
    on windows you recieve WM_QUERYENDSESSION then a WM_ENDSESSION.
    Free the weed!! Class B to class C is not good enough!!
    And the FAQ is here :- http://faq.cprogramming.com/cgi-bin/smartfaq.cgi

  4. #4
    Registered User Queatrix's Avatar
    Join Date
    Apr 2005
    Posts
    1,342
    thanks, Stoned_Coder. Thats what I was looking for.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Linux database system needed
    By BobS0327 in forum Tech Board
    Replies: 7
    Last Post: 06-11-2006, 03:56 PM
  2. measuring system resources used by a function
    By Aran in forum C Programming
    Replies: 1
    Last Post: 03-13-2006, 05:35 PM
  3. New system build wont boot
    By lightatdawn in forum Tech Board
    Replies: 7
    Last Post: 12-02-2005, 06:58 AM
  4. BIOS system and memory allocation problem
    By beely in forum Tech Board
    Replies: 9
    Last Post: 11-25-2003, 07:12 AM
  5. Problem Reporting System. Need Advide!
    By brunomiranda in forum Tech Board
    Replies: 9
    Last Post: 09-25-2003, 09:21 PM