Jump to content

This site uses cookies. By continuing to browse the site you are agreeing to our use of cookies. Find out more here. X
X


Photo

Add a static button to the TaskBar (xp/Win7)


  • Please log in to reply
2 replies to this topic

#1 nadigo

nadigo

    Seeker

  • Active Members
  • 21 posts

Posted 27 November 2010 - 01:45 PM

Hi,

I am trying to add a button next to the start menu on xp / win7 and show a gui once it is clicked.
i added a band to the TaskBar rebar but i got to issues:

1. I can not figure out the right index to place it after the Start button (it is different between XP and Win7 i think)
2. in WIN7 is seems that the new band is not fully placed as the task bar is it below the regular quick start icons

any idea ?

Local $hTaskBar = _WinAPI_FindWindow("Shell_TrayWnd", "") Local $hRebar =  ControlGetHandle("[CLASS:Shell_TrayWnd]", "", "ReBarWindow321")     local $Rehighet = _GUICtrlRebar_GetBarHeight($hReBar) $btn = _GUICtrlButton_Create($hRebar, "",  0,0,35, _GUICtrlRebar_GetBarHeight($hReBar)) local $indx = _GUICtrlRebar_GetBandCount($hReBar)     _GUICtrlReBar_AddBand ($hRebar,  $btn , 25,25, "" ,  $indx, $RBBS_CHILDEDGE  + $RBBS_NOGRIPPER + $RBBS_FIXEDSIZE)     _WinAPI_SetParent($btn,$hReBar) GUISetState(@SW_SHOW,$hTaskBar)








#2 nadigo

nadigo

    Seeker

  • Active Members
  • 21 posts

Posted 27 November 2010 - 10:18 PM

ok getting there, manged to pin a button on the taskbar in win7 but it crashes XP ...
anyone ?

Plain Text         
    Local $hgui, $hReBar, $btn,$chhnd     Local $hTaskBar = _WinAPI_FindWindow("Shell_TrayWnd", "")     Local $hRebar =  ControlGetHandle("[CLASS:Shell_TrayWnd]", "", "ReBarWindow321")     local $Rehighet = _GUICtrlRebar_GetBarHeight($hReBar)         GUIRegisterMsg($WM_COMMAND, "WM_COMMAND")     ;GUIRegisterMsg($WM_NOTIFY, "WM_NOTIFY")     local $indx =  _GUICtrlRebar_GetBandCount($hReBar)     local $NewBand = 1         $hgui = GUICreate("", 30, _GUICtrlRebar_GetBarHeight($hReBar), Default, Default,  BitOR($WS_POPUP, $WS_EX_TOOLWINDOW))     $btn = _GUICtrlButton_Create($hgui, "OK", 0,0,30, _GUICtrlRebar_GetBarHeight($hReBar))     _GUICtrlReBar_AddBand ($hRebar,  $hgui , 30,_GUICtrlRebar_GetBarHeight($hReBar), "" ,$indx, $RBBS_CHILDEDGE  + $RBBS_NOGRIPPER + $RBBS_FIXEDSIZE)     _GUICtrlRebar_MoveBand ($hRebar, $indx,$NewBand)     ;_WinAPI_SetParent($hgui,$hTaskBar)     ;GUISetState() ;#debug info to Console   ConsoleWrite("==========================" & @CRLF & _GUICtrlRebar_GetBandCount($hReBar) & @CRLF )     For $x = 0 To _GUICtrlRebar_GetBandCount($hReBar)-1     ConsoleWrite    ("============================================" & @CRLF)         ConsoleWrite ("Band Index " & $x & @TAB & "ID: " & _GUICtrlRebar_GetBandID($hReBar, $x) & @TAB &  "Name:" & _GUICtrlRebar_GetBandText ($hReBar, $x) & @CRLF)     Next     While 1     WEnd Func _Exit()         _GUICtrlRebar_DeleteBand ($hReBar,$NewBand)         Exit EndFunc   ;==>_Exit ; React on a button click Func WM_COMMAND($hWnd, $Msg, $wParam, $lParam)     #forceref $hWnd, $Msg     Local $nNotifyCode = BitShift($wParam, 16)     Local $nID = BitAND($wParam, 0x0000FFFF)     Local $hCtrl = $lParam     Local $sText = ""         Switch $hCtrl         Case $btn, $rdo, $chk             Switch $nNotifyCode                 Case $BN_CLICKED                     $sText = "$BN_CLICKED" & @CRLF                     _exit ()                  Case $BN_PAINT                     $sText = "$BN_PAINT" & @CRLF                 Case $BN_PUSHED, $BN_HILITE                     $sText = "$BN_PUSHED, $BN_HILITE" & @CRLF                 Case $BN_UNPUSHED, $BN_UNHILITE                     $sText = "$BN_UNPUSHED" & @CRLF                 Case $BN_DISABLE                     $sText = "$BN_DISABLE" & @CRLF                 Case $BN_DBLCLK, $BN_DOUBLECLICKED                     $sText = "$BN_DBLCLK, $BN_DOUBLECLICKED" & @CRLF                 Case $BN_SETFOCUS                     $sText = "$BN_SETFOCUS" & @CRLF                 Case $BN_KILLFOCUS                     $sText = "$BN_KILLFOCUS" & @CRLF             EndSwitch                         ConsoleWrite($sText & _                     "-----------------------------" & @CRLF & _                     "WM_COMMAND - Infos:" & @CRLF & _                     "-----------------------------" & @CRLF & _                     "Code" & @TAB & ":" & $nNotifyCode & @CRLF & _                     "CtrlID" & @TAB & ":" & $nID & @CRLF & _                     "CtrlHWnd:" & $hCtrl & @CRLF & _                     _GUICtrlButton_GetText($hCtrl) & @CRLF)             Return 0 ; Only workout clicking on the button     EndSwitch     ; Proceed the default Autoit3 internal message commands.     ; You also can complete let the line out.     ; !!! But only 'Return' (without any value) will not proceed     ; the default Autoit3-message in the future !!!     Return $GUI_RUNDEFMSG EndFunc   ;==>WM_COMMAND


#3 nadigo

nadigo

    Seeker

  • Active Members
  • 21 posts

Posted 05 December 2010 - 08:45 PM

still i can get it working in Xp - anyone ?




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users