taskbar button

Started by Rudolf Fürstauer, December 11, 2006, 05:07:24 PM

Previous topic - Next topic

Rudolf Fürstauer

Perhaps there is a problem in FF??

I want do hide the dialog after klick on SC_MINIMIZE -
the dialog is not visible and i get the systemtrayicon,
but the button of the application is still visible in the taskbar.
There is no difference whether i use WS_EX_APPWINDOW or not.

   '===========================================
   'minimieren des Dialog
   '===========================================
Case %SC_MINIMIZE
   'Icon für Anwendung in Systemtray
   ti.cbSize = SizeOf(ti)
   ti.hWnd = HWND_FRMMAIN
   ti.uID = hInstMain
   ti.uFlags = %NIF_ICON Or %NIF_MESSAGE Or %NIF_TIP
   ti.uCallbackMessage = %WM_TRAYICON
   ti.hIcon = LoadImage(hInstMain, "IconMain", %IMAGE_ICON, 16, 16, %LR_SHARED)
   ti.szTip = "Application"
   Shell_NotifyIcon %NIM_ADD, ti
       ShowWindow HWND_FRMMAIN, %SW_MINIMIZE

How can i hide the application in the taskbar too??
If i create a application with the PowerBasic editor, it works.

Thanks for any help

TechSupport

Try the following (basically, %SW_HIDE instead of %SW_MINIMIZE):

Function FORM1_CUSTOM ( _
                     hWndForm      As Dword, _  ' handle of Form
                     wMsg          As Long,  _  ' type of message
                     wParam        As Dword, _  ' first message parameter
                     lParam        As Long   _  ' second message parameter
                     ) As Long
 
  Select Case wMsg

     Case %WM_SYSCOMMAND
        If wParam = %SC_MINIMIZE Then
           Local ti As NOTIFYICONDATA
           
           'Icon für Anwendung in Systemtray
           ti.cbSize           = SizeOf(ti)
           ti.hWnd             = hWndForm
           ti.uID              = App.hInstance
           ti.uFlags           = %NIF_ICON Or %NIF_MESSAGE Or %NIF_TIP
           ti.uCallbackMessage = %WM_TRAYICON
           ti.hIcon            = LoadImage( App.hInstance, "IconMain", %IMAGE_ICON, 16, 16, %LR_SHARED )
           ti.szTip            = "Application"
           Shell_NotifyIcon %NIM_ADD, ti
       
           '// programmatically minimize the window
           ShowWindow hWndForm, %SW_HIDE  

           '// bypass the default processing of this message
           Function = %TRUE: Exit Function                  
           
        End If

  End Select
 
End Function

Rudolf Fürstauer

Thanks Paul,

with

Function = %True

it works!

Roger Garstang

Yup, can't forget the Function= %TRUE, otherwise it still processes the message.

Shouldn't we also:


Case %WM_SYSCOMMAND
  Select Case (wParam And &HFFF0)
      Case %SC_MINIMIZE
          ShowWindow(HWND_TRAYICONAPP, %SW_HIDE) 'hide prog so it doesn't appear in the task bar.
          Function= %TRUE
  End Select


From API:
"In WM_SYSCOMMAND messages, the four low-order bits of the uCmdType parameter are used internally by Windows. To obtain the correct result when testing the value of uCmdType, an application must combine the value 0xFFF0 with the uCmdType value by using the bitwise AND operator."