Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
CODE PROJECT For Those Who Code
  • Home
  • Articles
  • FAQ
Community
  1. Home
  2. General Programming
  3. C / C++ / MFC
  4. disable end program notification in console application

disable end program notification in console application

Scheduled Pinned Locked Moved C / C++ / MFC
c++debugginghelptutorialquestion
5 Posts 2 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • A Offline
    A Offline
    Arif Liminto
    wrote on last edited by
    #1

    Hi, I am still a newbie in MFC I 've got a problem with my console application program I use one thread in there , which is I use CWinThread and it terminates when time is equal to timeout but I need to handle if the user want to terminate immediately in the console application so the way I did is I create this function

    BOOL WINAPI ConsoleHandler(DWORD CEVENT)
    {
    switch(CEVENT)
    {
    case CTRL_CLOSE_EVENT://if user shutdown immediatelly
    myClass.CleanUpThread();

    	break;
    }
    return TRUE;
    

    }

    so when the user want to immediatelly, it will go to that function and clean up the thread however, everytime, I test and debug, I always windows ballon said that "windows cannot end this program, it may need more time to complete an operation" How to disable that ballon? so i dont want user to see that one, and the program will wait until the thread is cleared. Thanks so much,

    E 1 Reply Last reply
    0
    • A Arif Liminto

      Hi, I am still a newbie in MFC I 've got a problem with my console application program I use one thread in there , which is I use CWinThread and it terminates when time is equal to timeout but I need to handle if the user want to terminate immediately in the console application so the way I did is I create this function

      BOOL WINAPI ConsoleHandler(DWORD CEVENT)
      {
      switch(CEVENT)
      {
      case CTRL_CLOSE_EVENT://if user shutdown immediatelly
      myClass.CleanUpThread();

      	break;
      }
      return TRUE;
      

      }

      so when the user want to immediatelly, it will go to that function and clean up the thread however, everytime, I test and debug, I always windows ballon said that "windows cannot end this program, it may need more time to complete an operation" How to disable that ballon? so i dont want user to see that one, and the program will wait until the thread is cleared. Thanks so much,

      E Offline
      E Offline
      Eytukan
      wrote on last edited by
      #2

      Clean up thread? I think you are trying to clean up a live wire with your wet hands. Are you trying to terminate() your thread by force? if yes never do it. Just come out of the loop with a boolean condition check like. while(bRunThread) { //run mad } When the user wants to come out, just set bRunThread =false.. and you can also use events to make sure the thread has really exited.


      OK,. what country just started work for the day ? The ASP.NET forum is flooded with retarded questions. -Christian Graus Best wishes to Rexx[^]

      A 1 Reply Last reply
      0
      • E Eytukan

        Clean up thread? I think you are trying to clean up a live wire with your wet hands. Are you trying to terminate() your thread by force? if yes never do it. Just come out of the loop with a boolean condition check like. while(bRunThread) { //run mad } When the user wants to come out, just set bRunThread =false.. and you can also use events to make sure the thread has really exited.


        OK,. what country just started work for the day ? The ASP.NET forum is flooded with retarded questions. -Christian Graus Best wishes to Rexx[^]

        A Offline
        A Offline
        Arif Liminto
        wrote on last edited by
        #3

        thanks I've fixed that one

        E 1 Reply Last reply
        0
        • A Arif Liminto

          thanks I've fixed that one

          E Offline
          E Offline
          Eytukan
          wrote on last edited by
          #4

          What was the problem?


          OK,. what country just started work for the day ? The ASP.NET forum is flooded with retarded questions. -Christian Graus Best wishes to Rexx[^]

          A 1 Reply Last reply
          0
          • E Eytukan

            What was the problem?


            OK,. what country just started work for the day ? The ASP.NET forum is flooded with retarded questions. -Christian Graus Best wishes to Rexx[^]

            A Offline
            A Offline
            Arif Liminto
            wrote on last edited by
            #5

            I changed the way my program works. instead, waiting for period of time, then shutdown I keep it loop until keyboard event occurs or user press close and I discovered that there were some memory leaks in my program. I fixed the memory leak, change the program flow and done Anyway, thanks for your help Regards, Arif Liminto

            1 Reply Last reply
            0
            Reply
            • Reply as topic
            Log in to reply
            • Oldest to Newest
            • Newest to Oldest
            • Most Votes


            • Login

            • Don't have an account? Register

            • Login or register to search.
            • First post
              Last post
            0
            • Categories
            • Recent
            • Tags
            • Popular
            • World
            • Users
            • Groups