Announcement

Collapse
No announcement yet.

To Nathan Evans

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

  • To Nathan Evans

    Nathan,

    Did you ever figure how to put an icon in the system tray, using
    a MODELESS DIALOG, *without* the DIALOG flashing on the Desktop
    or the Taskbar before it was hidden? That's something I have
    yet to figure out. In a reply to one of my prior postings,
    Mr. Semen Matusovski assured me that it is possible to put an
    icon in the Taskbar Notification Area, and have it respond to
    mouse clicks with popup menu's, without even needing a parent
    dialog. I have not been able to figure out how to do this.
    As far as I can determine, a CALLBACK FUNCTION is needed to
    accept/respond to the windows messages that is sent to the
    app. And, I don't believe you can have a Callback Function
    without a parent dialog/window.

    Anybody have any ideas on this matter? If you do, I shouldn't
    need example code to be posted - it should be sufficient to
    tell me the steps necessary.

    Thanks in advance!


    ------------------
    Clay C. Clear

    http://www.v3space.com/a/a39/202/

    [email protected]
    [email protected]

  • #2
    Some code anyway....Hopefully this will be self-explanatory, your hwnd is a child under desktop, hidden, then do the normal NIM_ADD stuff for the taskbar....

    Code:
    'Do your register class stuff here
    '
    Then
    '
    
    '--------------------------------------------------------------
    '*Get the handle of an existing window and pass this on as the
    ' parent to this window so we can hide our process from showing
    ' up on the task bar
    '--------------------------------------------------------------
    'hdTopWnd& = GetDeskTopWindow()
     hNextWnd = GetTopWindow(0)
     hParent  = GetParent(hNextWnd)
    '--------------------------------------------------------------
    'hParent& = %NULL
    
    hWnd = CreateWindowEx(0,szClassName, _
                          "", _
                          %WS_POPUP Or %WS_DLGFRAME,_
                          %CW_USEDEFAULT, _
                          %CW_USEDEFAULT, _
                          %CW_USEDEFAULT, _
                          %CW_USEDEFAULT, _
                          hParent, _ '<-- assign to a parent window
                          %NULL, _
                          hInstance, _
                          ByVal %NULL)
    
    'ShowWindow hWnd, iCmdShow
    UpdateWindow hWnd
    
    'Remove from Task list
    pid = GetCurrentProcessId()
    RegisterServiceProcess pid, 1  
    
    '
    '
    '
    '
    Don't forget to destroy it:
           Case %WM_DESTROY
                PostQuitMessage 0
    ------------------
    Scott
    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


    • #3
      By the way, this is from SPYDER, an invisible program designed to gether information from a PC (Not spyware, but SPYWARE for security reasons not advertising).


      There is no window created or visible, it's not "Modeless" so to speak but it works...
      You should then be able to use the tray sample from the samples folder and go from there....



      ------------------
      Scott
      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
        Thanks, Scott!

        I've never messed with registering windows classes, but I'm
        pretty adroit at figuring out MOST stuff from the Win32.Hlp
        and MSDN. All of my programs so far have been of the basic
        (pun not intended) utilities type that never required advanced
        windows/dialog programming.

        OK, now I've got some learning to do!

        Thanks, again!


        ------------------
        Clay C. Clear

        http://www.v3space.com/a/a39/202/

        [email protected]
        [email protected]

        Comment


        • #5
          Clay,

          I've come straight from Visual Basic, so i'm new to handling my own
          window messages.. I can't get my window to not flash in the taskbar yet,
          i'll have a look at the code Scott kindly posted.

          - Nathan.

          Comment


          • #6
            Nathan, toolwindows do not show in the taskbar, so create the window using the extended style %WS_EX_TOOLWINDOW... make your DIALOG NEW statement like this (untested, off the top of my head):
            Code:
            DIALOG NEW hWndParent, "Toolwindow title", x, y, xx, yy, _  
              %WS_SYSMENU OR %WS_THICKFRAME OR %DS_MODALFRAME, _  
              %WS_EX_TOOLWINDOW TO hDlg
            ------------------
            Lance
            PowerBASIC Support
            mailto:[email protected][email protected]</A>
            Lance
            mailto:[email protected]

            Comment


            • #7
              Nathan,

              This message is for your information. I have found out, through
              empirical testing, that if you use ShellExecute in a program
              to run other programs asynchronously, it's not sufficient to
              just use the DIALOG statement that Lance provided in order to
              prevent the apps from flashing on the Taskbar. You've also got
              to use the %SW_HIDE flag as the last parameter in the statement
              that calls ShellExecute. Apparently, the last parameter in
              that function (which is the window show state flag) overrides
              the dialog new statement settings in the program that is
              shelled to. My dialogs weren't actually displaying on the
              screen, but they were flashing briefly in the Taskbar. Once
              I changed the show window flag in the ShellExecute statement
              from %SW_SHOWNORMAL to %SW_HIDE, the flashings in the
              Taskbar disappeared. So, from the source that Lance nicely
              provided, and from what I just learned, my dialogs don't
              flash ANYWHERE on the screen.

              You'll probably find this message useless, as I don't know
              how common it is for other Members here to use ShellExecute,
              but if you do, then I hope this helped!

              Thanks, Lance!

              P.S. My dialogs are all MODELESS. The WINMAIN functions use
              DOEVENTS loops.



              ------------------
              Clay C. Clear

              http://www.v3space.com/a/a39/202/

              [email protected]
              [email protected]

              Comment

              Working...
              X