Jump to content
Sign in to follow this  
Getz

V C++ .net, Camne Nak Detect Shutdown

Recommended Posts

Assalamualaikum...

Aku sedang belaja V C++ .NET.

Dgn menggunakan Win32 Window Application, aku cuba buat satu program yg bila kita shut down komputer, dalam masa komputer tu nak shut down, maka keluar message box "Windows Is Shutting Down".

Problemnya, mcm mana kita nak detect yg PC kita tu nak shut down, aku cuba masukkan kod utk keluarkan message box tu dalam WM_DESTROY, tapi tak jadi gak, maknanya kalau program tu di'destroy' disebabkan Windows nak shut down, maka dia tak akan kirimkan message WM_DESTROY.

jadi, kpd sifu2 semua, tolong tunjuk ajar mcm mana nak detect shut down,..

TQ

Share this post


Link to post
Share on other sites

case WM_QUERYENDSESSION:
        int r; 
        r = MessageBox(NULL, "Windows Is Shutting Down","Shut Down", MB_YESNO); 
        if(r == IDYES)
            return true;
        else
            return false;
        break;

cuba try code diatas, not sure dia boleh detect semua shutdown especially yang force atau yang dimulakan oleh program lain

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
Sign in to follow this  

×
×
  • Create New...