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
  1. Home
  2. General Programming
  3. C / C++ / MFC
  4. how to abort application

how to abort application

Scheduled Pinned Locked Moved C / C++ / MFC
9 Posts 4 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.
  • H Offline
    H Offline
    hemlat
    wrote on last edited by
    #1

    Hi, In my application I am using Active Sync to connect my PC to Mobile(Windows Mobile).I am using CeCreateProcess() function to invoke exe in mobile.I need to abort my application. For that I have created one button on my dialog.I have added event handler to that.I have added

    PostQuitMessage(0);

    while running the application If I click on "Abort" button application is not closing at that point.After completion of present running task only application is closing. For example I am executing testcycle.In the middle I need to abort my application.Can anyone help me. Rekha.

    I S T 3 Replies Last reply
    0
    • H hemlat

      Hi, In my application I am using Active Sync to connect my PC to Mobile(Windows Mobile).I am using CeCreateProcess() function to invoke exe in mobile.I need to abort my application. For that I have created one button on my dialog.I have added event handler to that.I have added

      PostQuitMessage(0);

      while running the application If I click on "Abort" button application is not closing at that point.After completion of present running task only application is closing. For example I am executing testcycle.In the middle I need to abort my application.Can anyone help me. Rekha.

      I Offline
      I Offline
      Iain Clarke Warrior Programmer
      wrote on last edited by
      #2

      The clue is in the api command's name.

      PostQuitMessage (0)

      . It POSTs a WM_QUIT message to the message queue. This is a signal for your message loop to exit. While you are still in a function, you're not handling messages... so you don't quit. ie:

      void CMyApp:OnSomeButton ()
      {
      PostQuitMessage (0);
      Sleep (10000);
      }

      will take 10 seconds before it even could quit. Not knowing what you're doing, that's as helpful as I can be at the moment.

      In the process of moving to Sweden for love (awwww). If you're in Scandinavia and want an MVP on the payroll (or happy with a remote worker), give me a job!

      H 1 Reply Last reply
      0
      • H hemlat

        Hi, In my application I am using Active Sync to connect my PC to Mobile(Windows Mobile).I am using CeCreateProcess() function to invoke exe in mobile.I need to abort my application. For that I have created one button on my dialog.I have added event handler to that.I have added

        PostQuitMessage(0);

        while running the application If I click on "Abort" button application is not closing at that point.After completion of present running task only application is closing. For example I am executing testcycle.In the middle I need to abort my application.Can anyone help me. Rekha.

        S Offline
        S Offline
        Stuart Dootson
        wrote on last edited by
        #3

        exit[^] instead of PostQuitMessage?

        Java, Basic, who cares - it's all a bunch of tree-hugging hippy cr*p

        H 1 Reply Last reply
        0
        • I Iain Clarke Warrior Programmer

          The clue is in the api command's name.

          PostQuitMessage (0)

          . It POSTs a WM_QUIT message to the message queue. This is a signal for your message loop to exit. While you are still in a function, you're not handling messages... so you don't quit. ie:

          void CMyApp:OnSomeButton ()
          {
          PostQuitMessage (0);
          Sleep (10000);
          }

          will take 10 seconds before it even could quit. Not knowing what you're doing, that's as helpful as I can be at the moment.

          In the process of moving to Sweden for love (awwww). If you're in Scandinavia and want an MVP on the payroll (or happy with a remote worker), give me a job!

          H Offline
          H Offline
          hemlat
          wrote on last edited by
          #4

          Hi, In my Application I am connecting to Mobile and sending data to Mobile from my computer using socket.And I am receiving information from Mobile. If I click on Abort button I need to stop Application.I am using MFC. Can I use PostQuitMessage(0) for this?

          I 1 Reply Last reply
          0
          • S Stuart Dootson

            exit[^] instead of PostQuitMessage?

            Java, Basic, who cares - it's all a bunch of tree-hugging hippy cr*p

            H Offline
            H Offline
            hemlat
            wrote on last edited by
            #5

            Hi, exit is not working.I am sending Data from my PC to Mobile.And I am receving data from my Mobile by using socket.I need to abort this operation.

            1 Reply Last reply
            0
            • H hemlat

              Hi, In my Application I am connecting to Mobile and sending data to Mobile from my computer using socket.And I am receiving information from Mobile. If I click on Abort button I need to stop Application.I am using MFC. Can I use PostQuitMessage(0) for this?

              I Offline
              I Offline
              Iain Clarke Warrior Programmer
              wrote on last edited by
              #6

              hemlat wrote:

              Can I use PostQuitMessage(0) for this?

              YES. Now go and read my message again - it won't stop straight away. If you do many other things after the PostQuitMessage command, it will do them first. Iain.

              In the process of moving to Sweden for love (awwww). If you're in Scandinavia and want an MVP on the payroll (or happy with a remote worker), give me a job!

              1 Reply Last reply
              0
              • H hemlat

                Hi, In my application I am using Active Sync to connect my PC to Mobile(Windows Mobile).I am using CeCreateProcess() function to invoke exe in mobile.I need to abort my application. For that I have created one button on my dialog.I have added event handler to that.I have added

                PostQuitMessage(0);

                while running the application If I click on "Abort" button application is not closing at that point.After completion of present running task only application is closing. For example I am executing testcycle.In the middle I need to abort my application.Can anyone help me. Rekha.

                T Offline
                T Offline
                ThatsAlok
                wrote on last edited by
                #7

                it seems to dialog based application, why don't your try EndDialog() api!

                "Opinions are neither right nor wrong. I cannot change your opinion. I can, however, change what influences your opinion." - David Crow
                Never mind - my own stupidity is the source of every "problem" - Mixture

                cheers, Alok Gupta VC Forum Q&A :- I/IV Support CRY- Child Relief and You

                H 1 Reply Last reply
                0
                • T ThatsAlok

                  it seems to dialog based application, why don't your try EndDialog() api!

                  "Opinions are neither right nor wrong. I cannot change your opinion. I can, however, change what influences your opinion." - David Crow
                  Never mind - my own stupidity is the source of every "problem" - Mixture

                  cheers, Alok Gupta VC Forum Q&A :- I/IV Support CRY- Child Relief and You

                  H Offline
                  H Offline
                  hemlat
                  wrote on last edited by
                  #8

                  I need to close application immediately after clicking the abort button.

                  T 1 Reply Last reply
                  0
                  • H hemlat

                    I need to close application immediately after clicking the abort button.

                    T Offline
                    T Offline
                    ThatsAlok
                    wrote on last edited by
                    #9

                    call EndDialog there only!

                    "Opinions are neither right nor wrong. I cannot change your opinion. I can, however, change what influences your opinion." - David Crow
                    Never mind - my own stupidity is the source of every "problem" - Mixture

                    cheers, Alok Gupta VC Forum Q&A :- I/IV Support CRY- Child Relief and You

                    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