Announcement

Collapse
No announcement yet.

Idle

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

  • Idle

    I have a program that runs silently (no visible interaction) when a PC is started up.

    If I want that application to remove it'self from the taskbar, and just sit idle...how would I do that?

    I don't draw a gui and I just want it to sit there and spin..
    It is a registered class also..

    Scott

    -------------
    Scott
    mailto:[email protected][email protected]</A>
    Scott Turchin
    MCSE, MCP+I
    http://www.tngbbs.com
    ----------------------
    True Karate-do is this: that in daily life, one's mind and body be trained and developed in a spirit of humility; and that in critical times, one be devoted utterly to the cause of justice. -Gichin Funakoshi

  • #2
    Scott --
    It's necessary to use %WS_EX_TOOLWINDOW
    Code:
       #Compile Exe
       #Register None
       #Dim All
       #Include "Win32Api.Inc"
       
       CallBack Function DlgProc
          Static nt As Long
          Select Case CbMsg
             Case %WM_INITDIALOG: SetTimer CbHndl, 1, 2000, ByVal 0
             Case %WM_PAINT: ShowWindow CbHndl, 0
             Case %WM_TIMER: Beep: Incr nt: If nt >= 5 Then _
                             KillTimer CbHndl, 1: Dialog End CbHndl
          End Select
       End Function
       
       Function PbMain
          Local hDlg As Long
          Dialog New 0, "Semen", ,, 50,50, %WS_POPUP, %WS_EX_TOOLWINDOW To hDlg
          Dialog Show Modeless hDlg Call DlgProc
          Local x As Long
          Do
             Dialog DoEvents To x&
             If x& = 0 Then Exit Do
          Loop
          MsgBox "Ok"
       End Function
    I used Modeless, because I saw such recommendation.
    But at least in some OSes it's not necessary.



    [This message has been edited by Semen Matusovski (edited April 08, 2000).]

    Comment


    • #3
      OK that might work, but deal is that I will need a signal from Windows ie WM_SHUTDOWN or something like that to indicate the user is eiter logging off or rebooting...
      I suppose WM_CLOSE would be the one I am looking for?

      Scott



      ------------------
      Scott
      mailto:[email protected][email protected]</A>
      Scott Turchin
      MCSE, MCP+I
      http://www.tngbbs.com
      ----------------------
      True Karate-do is this: that in daily life, one's mind and body be trained and developed in a spirit of humility; and that in critical times, one be devoted utterly to the cause of justice. -Gichin Funakoshi

      Comment


      • #4
        Scott --
        You should process %WM_QUERYENDSESSION
        But don't forget that exist ExitWindowsEx with EWX_FORCE.

        There is one strange monent with %WM_QUERYENDSESSION (or I don't understand win32.hlp ?).
        On my PC, Win2000, DDT, to refuse from logoff/shutdown it's necessary
        CASE %WM_QUERYENDSESSION: Function = %True: Exit Function
        (I expected Function = %False)



        ------------------

        Comment


        • #5
          I have a Windows 2000 server here at home if you want me to do any testing, I built this monster machine just for Windows 2000


          Anyway, Not sure on the QUERYENDSESSION except to say that Windows MAY try to process THAT ONE first before it does the EWX_FORCE, which makes sense to me...so it should return a true????


          Scott

          ------------------
          Scott
          mailto:[email protected][email protected]</A>
          Scott Turchin
          MCSE, MCP+I
          http://www.tngbbs.com
          ----------------------
          True Karate-do is this: that in daily life, one's mind and body be trained and developed in a spirit of humility; and that in critical times, one be devoted utterly to the cause of justice. -Gichin Funakoshi

          Comment


          • #6
            Scott --
            This works on my PC (refuse by %True). Exactly this is stange.
            Code:
               #Compile Exe
               #Register None
               #Dim All
               #Include "Win32Api.Inc"
            
               CallBack Function DlgProc
                  Select Case CbMsg
                     Case %WM_PAINT: ShowWindow CbHndl, 0
                     Case %WM_QUERYENDSESSION
                          MsgBox "Refuse": Function = %True: Exit Function
            
                  End Select
               End Function
            
               Function PbMain
                  Local hDlg As Long
                  Dialog New 0, "Semen", ,, 50,50, %WS_POPUP, %WS_EX_TOOLWINDOW To hDlg
                  Dialog Show Modeless hDlg Call DlgProc
                  Local x As Long
                  Do
                     Dialog DoEvents To x&
                     If x& = 0 Then Exit Do
                  Loop
               End Function
            About ExitWindowsEx.
            If one app termnates other apps with parameter EWX_FORCE, your app will not receive %WM_QUERYENDSESSION.
            Of course, if it will be done manually by Start - Shut down, your app will receive this message.




            ------------------

            Comment


            • #7
              So if I am terminated by another app or the three finger salute, then I would expect to receive %WM_DESTROY, is that a safe assumption???


              Thanks for the info too!

              Scott


              ------------------
              Scott
              mailto:[email protected][email protected]</A>
              Scott Turchin
              MCSE, MCP+I
              http://www.tngbbs.com
              ----------------------
              True Karate-do is this: that in daily life, one's mind and body be trained and developed in a spirit of humility; and that in critical times, one be devoted utterly to the cause of justice. -Gichin Funakoshi

              Comment


              • #8
                Scott --
                As I understand, your "hidden" app never will receive WM_DESTROY:
                Code:
                1) If user will terminate your app by Ctrl-Alt-Del OR 
                   "End-Process" using Task-Manager your app receives nothing.
                2) The same if another app uses ExitWindowsEx with EWX_FORCE to log off or reboot (this is abnormal way).
                
                3) If user manually clicks Start - Shut Down - Log Off / Shut Down / Restart OR
                   another app uses ExitWindowsEx with EWX_LOGOFF/EWX_POWEROFF/WX_REBOOT/EWX_SHUTDOWN your app WILL receive %WM_QUERYENDSESSION and you can agree or disagree.
                ------------------

                Comment

                Working...
                X