Announcement

Collapse
No announcement yet.

Detect if program has become a background process?

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • #21
    Re:
    It looks like Windows10 does eventually get around to closing the process - takes a long time though .. about 6 minutes!
    That was yesterday! - I noticed the behaviour a couple of times, stuck a timer and MsgBox in the code (measured ~350 odd seconds) - unable to repeat today [RollEyes!] - it just sits there in "Background processes" until 'End task' is used.
    Rgds, Dave

    Comment


    • #22
      There must be some work around on this issue, as many of my programs have the following statement
      DIALOG SHOW MODAL hDlg Call DlgProc changing them to modeless or MSGBOX Indirect can be tough.

      Comment


      • #23
        Hi Anne,

        If your Modal App might run in WIndows10 you could add this to DlgProc() to avoid the problem discovered by Ketil..
        Code:
           Case %WM_Destroy
             PostQuitMessage 0
        Rgds, Dave

        Comment


        • #24
          Yep,
          PostQuitMessage(0) or PostMessage(hDlg, %WM_QUIT, 0, 0) in WM_DESTROY is a workaround.

          Problem is that we are not sure of what DDT is going on under the hood.
          A modal DDT dialog is suppose to end via DIALOG END.
          PostQuitMessage(0) is not supposed to be used, nor WM_QUIT.

          Is this workaround is viable or will we get more bads surprises later?
          More works is needed, I guess that some of us will have to test further.

          Until proven bad, the workaround might be acceptable.
          In my opinion, since there is no problems with modeless dialog,
          the safest solution is probably to change from modal to modeless.

          The ideal would be to have Tom analyse the compiler, find the problem,
          and write a patch that resolve it. Since Tom is not often around,
          I guess that this is not an option.

          I remember that there was some discussion about PostQuitMessage in DDT with Bob.
          Since he wrote the compiler, maybe we will get valuable infos from those posts.

          Pierre
          Last edited by Pierre Bellisle; 9 Jun 2017, 05:23 PM.

          Comment


          • #25
            Thanks Dave and Pierre,

            There is an article on PostQuitMessage in the forum, see post #5 but it relates to SDK programming

            https://forum.powerbasic.com/forum/u...-destroywindow



            Comment


            • #26
              I just thought I'd mention, we have still not see the code which is failing from Post#1 (with workaround in #18, which shouldn't even be possible to do using the "HelloDDT" program as stated in Post#1).

              I do think helloddt is flawed since there is no provision other than "DDT Default Processing [whatever that is]" for user actions resulting in WM_SYSCOMMAND/SC_CLOSE. (If default 'does something' then DIALOG END is never executed unless that is the 'DDT default processiing).

              Call me crazy but I would think if you want help with a certain piece of code you have to supply that code.

              I would agree that "IF" Windows/10 is not terminating a properly-coded program on anything close to a timely basis, then some workaround would be needed if you, say, wanted to change something and recompile; or if there is code to prevent multiple simultaneous instances. But right now I sure can't say I have seen a properly-coded program - or even an improperly-coded program. The insertion of "PostQuitMessage" (Post #18) I know I don't like for the reasons stated earlier.

              MCM
              Michael Mattias
              Tal Systems Inc. (retired)
              Racine WI USA
              [email protected]
              http://www.talsystems.com

              Comment


              • #27
                Here is a zip file everything needed ready to compile , one program ddt one sdk

                Unzip them to a folder run each one and terminate them the failing way from the task bar.

                There will be a log file created and it logs the window messages, looking to see what is sent and if there is some strange messages with ddt

                Working on a better one , this is for testing the waters , not running win 10 looking to see if there is an obvious reason.

                All it is at this point it logs windows message in plain text

                questions ask, any feed back or data will be greatly appreciated

                . DIALOGS.zip

                Mike
                Attached Files
                A dozen what.

                Comment


                • #28
                  FYI It seems that the problem has been resolved by a Windows 10 Update. I am no longer able to reproduce the results observed by Ketil in Post#1.

                  The modal DDT dialogs close normally now - no longer hide as "Background Processes" if closed using the taskbar Icon/ right-click menu.

                  Windows 10 Pro. Version 1703. OS Build 15063.786

                  Rgds, Dave

                  Comment


                  • #29
                    Heads Up !

                    This behaviour is back as of Windows 10 'Update' to version 1903

                    Use of
                    Code:
                       Case %WM_Destroy
                         PostQuitMessage 0
                    is back in vogue to ensure that Apps closed from the TaskBar will NOT become 'Background processes' nor linger in the Details tab in TaskManager, giving rise to "Error 613 in (0:000): Cannot compile - the program is now running"
                    Rgds, Dave

                    Comment


                    • #30
                      Dave,
                      Windows 10 1903,
                      PBWIN10.4
                      '==============================================================================
                      '
                      ' HELLODDT.BAS for PowerBASIC for Windows
                      ' Copyright (c) 1997-2011 PowerBASIC, Inc.
                      ' All Rights Reserved.
                      '
                      ' A simple DDT dialog example.
                      '
                      '==============================================================================

                      I'm not noticing it here. Closes every time from the task bar.

                      Comment


                      • #31
                        Yeah me too since 1/8

                        Seems 1903 is rather 'fluid' - see post here re issue with Task Manager.
                        Rgds, Dave

                        Comment

                        Working...
                        X