Results 1 to 9 of 9

Thread: Detect windows shutdown in consol application

Threaded View

  1. #8

    Thread Starter
    Addicted Member
    Join Date
    Jul 2009
    Posts
    140

    Re: Detect windows shutdown in consol application

    as in previous post, i am using followwing code to detect the shutdown
    Code:
    protected override void WndProc(ref Message m)
            {
                if (m.Msg == WM_QUERYENDSESSION)
                {
                    
                    isShuttingDown = true;
                }
                base.WndProc(ref m);
            }
    When the program is in the while loop, if a shut down comes, the break point put inside above fucntion is not hit. So what do event i have to put it in the loop so that when a shutdown messge happens, i get out of the loop

    Did u mean put the code in do while loop?
    like this ?
    Code:
            do
                    {
                        path = "d:\\madavas2.txt";
                        deletefiles(path);                                      
                        createfiles(path);                                      
    
                        readtext = readroutetable();                            
                        regMatch = "Active Routes:";
                        ActiveRoutes(regMatch, readtext);                       
    
                        Thread.Sleep(1000);                     
                        currentgateway();                                      
    
    
                        statuszain = comparerangeforz();                         
                        if (statuszain == true)
                        {
                            statusmada = comparerangeformada();                 
    
                        }
                        if (statusmada == true)
                        {
                            break;
                        }
                    } while (statusmada == false);
    Last edited by makdu; Jan 13th, 2010 at 03:30 AM.
    If you found my reply helpful, please rate me

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