Sign in to follow this  
Followers 0
happytc

It's really surprising!

1 post in this topic

click right key on the dockbar using following code, cannot correct to display the "Config window", why?

But if un-annotate this line: ;MsgBox(0,0,"0k")

all is ok, It's really surprising!

(IconDock.au3 file get from: )

#include <GuiConstantsEx.au3>
#include <GuiConstants.au3>
#include <WindowsConstants.au3>
#Include <Misc.au3>
#include "IconDock.au3"
 
 
HotKeySet("{ESC}", "_Exit")
 
Global $iIconSizeMin = 48
Global $iIconSizeMax = 96
 
Global $aIcon[8] = [7]
$aIcon[1] = @WindowsDir & "\explorer.exe"
$aIcon[2] = @SystemDir & "\taskmgr.exe"
$aIcon[3] = @SystemDir & "\write.exe"
$aIcon[4] = @SystemDir & "\notepad.exe"
$aIcon[5] = @SystemDir & "\osk.exe"
$aIcon[6] = @SystemDir & "\charmap.exe"
$aIcon[7] = @SystemDir & "\mspaint.exe"
 
Global $hIconDock = _IconDock_Create(0, @DesktopHeight - $iIconSizeMax - $iIconSizeMin, @DesktopWidth, $iIconSizeMax + $iIconSizeMin, BitOR($IconDock_Align_Horizontal, $IconDock_Center), $IconDock_Up, $iIconSizeMin, $iIconSizeMax, True)
 
_IconDock_BeginUpdate($hIconDock)
 
For $i = 1 To $aIcon[0]
        _IconDock_IconAddFile($hIconDock, $aIcon[$i], 0, "_EventFunction", $IconDock_RBUTTONDOWN)
Next
_IconDock_EndUpdate($hIconDock)
 
 
While 1
        Sleep(100)
WEnd
 
 
 
Func _EventFunction($hID, $iIconIndex, $iEventMsg)
        Switch $hID
                Case $hIconDock
                        Switch $iEventMsg
                                Case $IconDock_RBUTTONDOWN
                                        Local $moved = DockMoveBar($hIconDock)
                                        If $moved = False Then ; If $moved = true the bar was moved - don't open options.
                                                DockConfig()
                                        EndIf
                        EndSwitch
        EndSwitch
EndFunc
 
Func DockConfig()
        Local $hwdDock, $HRadio, $VRadio, $OKButton, $CancelButton, $msg
                
        $hwdDock = GUICreate("Dock Config", 280, 150)
        
        GUICtrlCreateLabel("IconSizeMin:", 10, 13, 80, 20)
        
        GUICtrlCreateLabel("IconSizeMax:", 10, 43, 80, 20)
        
        GUICtrlCreateLabel("Orientation:", 10, 83, 80, 20)
        $HRadio = GUICtrlCreateRadio("Horizontal", 100, 80, 100, 20)
        $VRadio = GUICtrlCreateRadio("Vertical", 200, 80, 100, 20)
 
        $OKButton = GUICtrlCreateButton("OK", 50, 120, 50, 20)
        $CancelButton = GUICtrlCreateButton("Cancel", 160, 120, 50, 20)
        
        GUISetState()
;MsgBox(0,0,"0k")
        While True
                $msg = GUIGetMsg()
 
                Switch $msg
                        Case $GUI_EVENT_CLOSE, $CancelButton
                                ExitLoop
                        Case $OKButton
                                MsgBox(0,"pressed", "Pressed OK Button")
                                ExitLoop
                EndSwitch
 
                Sleep(20)
                
        WEnd
        GUIDelete($hwdDock)
EndFunc
 
 
Func DockMoveBar($hwdGuiBar)
        Local $PosDiff[2], $WinPos, $WinPos2, $MousePos, $dll, $moved
        
        $dll = DllOpen("user32.dll")
        
        While 1
                $MousePos = MouseGetPos()
                $WinPos = WinGetPos($hwdGuiBar)
                $PosDiff[0] = $WinPos[0] - $MousePos[0]
                $PosDiff[1] = $WinPos[1] - $MousePos[1]
 
                While _IsPressed("02", $dll)
                        $MousePos = MouseGetPos()
                        WinMove($hwdGuiBar, "", $MousePos[0] + $PosDiff[0], $MousePos[1] + $PosDiff[1])
                WEnd
                Sleep(10)
                ExitLoop
        WEnd
        
        $WinPos2 = WinGetPos($hwdGuiBar, "")
        
        If ($WinPos[0] < $WinPos2[0] - 3) Or ($WinPos[1] < $WinPos2[1] - 3) Or ($WinPos[0] > $WinPos2[0] + 3) Or ($WinPos[1] > $WinPos2[1] + 3) Then
                $moved = True ; If the window was moved, don't run program on return.
        Else
                $moved = False
        EndIf
        
        Sleep(10)
        Return $moved   
EndFunc
 
Func _Exit()
        _IconDock_Destroy($hIconDock)
        Exit
EndFunc

Share this post


Link to post
Share on other sites



Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0