Jump to content

Small gui for quick link


ismee
 Share

Recommended Posts

  • Moderators

ismee,

Yes. :)

M23

Public_Domain.png.2d871819fcb9957cf44f4514551a2935.png Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind

Open spoiler to see my UDFs:

Spoiler

ArrayMultiColSort ---- Sort arrays on multiple columns
ChooseFileFolder ---- Single and multiple selections from specified path treeview listing
Date_Time_Convert -- Easily convert date/time formats, including the language used
ExtMsgBox --------- A highly customisable replacement for MsgBox
GUIExtender -------- Extend and retract multiple sections within a GUI
GUIFrame ---------- Subdivide GUIs into many adjustable frames
GUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView items
GUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeView
Marquee ----------- Scrolling tickertape GUIs
NoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxes
Notify ------------- Small notifications on the edge of the display
Scrollbars ----------Automatically sized scrollbars with a single command
StringSize ---------- Automatically size controls to fit text
Toast -------------- Small GUIs which pop out of the notification area

 

Link to comment
Share on other sites

Or this?

#include <StaticConstants.au3>
#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>
#include <EditConstants.au3>
;written by taietel
;modify to fit your needs
Global $bToggle = 0, $bEditToggle=0, $iW=500, $iH=350
$aDrive = DriveGetDrive("all")
Global $iItems=$aDrive[0]
Global $aButtons[$iItems][3]
$hGui = GUICreate("Select drives", $iW, $iH, -1, -1, BitOR($WS_POPUP, $WS_BORDER, $WS_CLIPSIBLINGS))
GUISetBkColor(0x000000)
$hExit = GUICtrlCreateIcon("shell32.dll", -28, $iW-24, 8, 16, 16, BitOR($SS_NOTIFY,$WS_GROUP))
GUICtrlSetTip(-1, "Close me!...")
GUICtrlSetCursor(-1,0)
GUICtrlSetDefColor(0xDEDEDE)

For $i=1 To $iItems-1
    Local $iIcon
    Switch DriveGetType($aDrive[$i])
        Case "fixed"
            $iIcon = -8
        Case "cdrom"
            $iIcon = -189
        Case "removable"
            $iIcon = -195
        Case "network"
            $iIcon = -10
        Case "ramdisk"
            $iIcon = -13
        Case Else
            $iIcon = -9
    EndSwitch
    $aButtons[$i][0] = GUICtrlCreateIcon("shell32.dll", $iIcon, 8, $iH-40, 32, 32, BitOR($SS_NOTIFY,$WS_GROUP))
    GUICtrlSetCursor(-1,0)
    GUICtrlSetState(-1,$GUI_HIDE)
    $aButtons[$i][1]=GUICtrlCreateLabel(StringUpper(DriveGetType($aDrive[$i]) & " " & $aDrive[$i]), 48, $iH-30,100,17,$SS_CENTERIMAGE)
    GUICtrlSetBkColor(-1,$GUI_BKCOLOR_TRANSPARENT)
    ;GUICtrlSetBkColor(-1,0x222222)
    GUICtrlSetCursor(-1,0)
    GUICtrlSetState(-1,$GUI_HIDE)
Next
$aButtons[0][0] = GUICtrlCreateIcon("shell32.dll", -131, 8, $iH-40, 32, 32, BitOR($SS_NOTIFY,$WS_GROUP))
GUICtrlSetCursor(-1,0)
GUICtrlSetTip(-1, "Press me to expand/retract!")
$aButtons[0][1]=GUICtrlCreateLabel("Drives", 48, $iH-30)
GUICtrlSetTip(-1, "Press me to expand/retract!")
GUICtrlSetBkColor(-1,$GUI_BKCOLOR_TRANSPARENT)
GUICtrlSetCursor(-1,0)
GUICtrlCreatePic("", 1, 1, $iW-2, $iH-2, BitOR($SS_NOTIFY,$WS_GROUP,$WS_CLIPSIBLINGS), $GUI_WS_EX_PARENTDRAG)
WinSetTrans($hGui,"",220)
GUISetState(@SW_SHOW)

While 1
    Sleep(10)
    $nMsg = GUIGetMsg()
    Switch $nMsg
        Case $GUI_EVENT_CLOSE, $hExit
            Exit
        Case $aButtons[0][0], $aButtons[0][1]
            _ExpandRetract()
        Case $aButtons[1][0] To $aButtons[$iItems-1][0], $aButtons[1][1] To $aButtons[$iItems-1][1]
            For $i=1 To $iItems-1
                If $nMsg = $aButtons[$i][0] Or $nMsg = $aButtons[$i][1] Then ShellExecute($aDrive[$i]&"\","","","open")
            Next
            Sleep(200)
            _ExpandRetract()
    EndSwitch
WEnd

Func _ExpandRetract()
    Switch $bToggle
        Case 0
            For $i=1 To $iItems-1
                ControlMove($hGui,"",$aButtons[$i][0], 8 + 2*$i^2, $iH - 40 - $i*32)
                ;~ControlMove($hGui,"",$aButtons[$i][0], 8, $iH - 40 - $i*32);VERTICAL
                GUICtrlSetState($aButtons[$i][0],$GUI_SHOW)
                ControlMove($hGui,"",$aButtons[$i][1], 48 + 2*$i^2, $iH - 30 - $i*32)
                ;~ControlMove($hGui,"",$aButtons[$i][1], 48, $iH - 30 - $i*32);VERTICAL
                GUICtrlSetState($aButtons[$i][1],$GUI_SHOW)
                Sleep(20)
            Next
            $bToggle=1
        Case 1
            For $i=$iItems-1 To 1 Step -1
                GUICtrlSetState($aButtons[$i][0],$GUI_HIDE)
                ControlMove($hGui,"",$aButtons[$i][0], 8, $iH-40)
                GUICtrlSetState($aButtons[$i][1],$GUI_HIDE)
                ControlMove($hGui,"",$aButtons[$i][1], 48, $iH-30)
                Sleep(20)
            Next
            $bToggle=0
    EndSwitch
EndFunc
Link to comment
Share on other sites

ismee, add $WS_EX_TOOLWINDOW to Zedna's suggestion:

#include <StaticConstants.au3>
#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>
#include <EditConstants.au3>
;written by taietel
;modify to fit your needs
Global $bToggle = 0, $bEditToggle=0, $iW=70, $iH=380
$aDrive = DriveGetDrive("all")
Global $iItems=$aDrive[0]
Global $aButtons[$iItems][3]
$hGui = GUICreate("Select drives", $iW, $iH, @DesktopWidth-$iW-20, @DesktopHeight-$iH-50, BitOR($WS_POPUP, $WS_BORDER, $WS_CLIPSIBLINGS), BitOR($WS_EX_TOPMOST,$WS_EX_TOOLWINDOW))
GUISetBkColor(0x000000)
$hExit = GUICtrlCreateIcon("shell32.dll", -28, $iW-24, 8, 16, 16, BitOR($SS_NOTIFY,$WS_GROUP))
GUICtrlSetTip(-1, "Close me!...")
GUICtrlSetCursor(-1,0)
GUICtrlSetDefColor(0xDEDEDE)

For $i=1 To $iItems-1
    Local $iIcon
    Switch DriveGetType($aDrive[$i])
        Case "fixed"
            $iIcon = -8
        Case "cdrom"
            $iIcon = -189
        Case "removable"
            $iIcon = -195
        Case "network"
            $iIcon = -10
        Case "ramdisk"
            $iIcon = -13
        Case Else
            $iIcon = -9
    EndSwitch
    $aButtons[$i][0] = GUICtrlCreateIcon("shell32.dll", $iIcon, 8, $iH-40, 32, 32, BitOR($SS_NOTIFY,$WS_GROUP))
    GUICtrlSetCursor(-1,0)
    GUICtrlSetState(-1,$GUI_HIDE)
    $aButtons[$i][1]=GUICtrlCreateLabel(StringUpper($aDrive[$i]), 48, $iH-30,100,17,$SS_CENTERIMAGE)
    GUICtrlSetBkColor(-1,$GUI_BKCOLOR_TRANSPARENT)
    GUICtrlSetCursor(-1,0)
    GUICtrlSetState(-1,$GUI_HIDE)
Next
$aButtons[0][0] = GUICtrlCreateIcon("shell32.dll", -131, 8, $iH-40, 32, 32, BitOR($SS_NOTIFY,$WS_GROUP))
GUICtrlSetCursor(-1,0)
GUICtrlSetTip(-1, "Press me to expand/retract!")
$aButtons[0][1]=GUICtrlCreateLabel(" ", 48, $iH-30)
GUICtrlSetTip(-1, "Press me to expand/retract!")
GUICtrlSetBkColor(-1,$GUI_BKCOLOR_TRANSPARENT)
GUICtrlSetCursor(-1,0)
_ExpandRetract()
GUICtrlCreatePic("", 1, 1, $iW-2, $iH-2, BitOR($SS_NOTIFY,$WS_GROUP,$WS_CLIPSIBLINGS), $GUI_WS_EX_PARENTDRAG)
WinSetTrans($hGui,"",180)
GUISetState(@SW_SHOW)

While 1
    Sleep(10)
    $nMsg = GUIGetMsg()
    Switch $nMsg
        Case $GUI_EVENT_CLOSE, $hExit
            Exit
        Case $aButtons[0][0], $aButtons[0][1]
            _ExpandRetract()
        Case $aButtons[1][0] To $aButtons[$iItems-1][0], $aButtons[1][1] To $aButtons[$iItems-1][1]
            For $i=1 To $iItems-1
                If $nMsg = $aButtons[$i][0] Or $nMsg = $aButtons[$i][1] Then ShellExecute($aDrive[$i]&"\","","","open")
            Next
    EndSwitch
WEnd

Func _ExpandRetract()
    Switch $bToggle
        Case 0
            For $i=1 To $iItems-1
                ;ControlMove($hGui,"",$aButtons[$i][0], 8 + 2*$i^2, $iH - 40 - $i*32)
                ControlMove($hGui,"",$aButtons[$i][0], 8, $iH - 40 - $i*32);VERTICAL
                GUICtrlSetState($aButtons[$i][0],$GUI_SHOW)
                ;ControlMove($hGui,"",$aButtons[$i][1], 48 + 2*$i^2, $iH - 30 - $i*32)
                ControlMove($hGui,"",$aButtons[$i][1], 48, $iH - 30 - $i*32);VERTICAL
                GUICtrlSetState($aButtons[$i][1],$GUI_SHOW)
                Sleep(20)
            Next
            $bToggle=1
        Case 1
            For $i=$iItems-1 To 1 Step -1
                GUICtrlSetState($aButtons[$i][0],$GUI_HIDE)
                ControlMove($hGui,"",$aButtons[$i][0], 8, $iH-40)
                GUICtrlSetState($aButtons[$i][1],$GUI_HIDE)
                ControlMove($hGui,"",$aButtons[$i][1], 48, $iH-30)
                Sleep(20)
            Next
            $bToggle=0
    EndSwitch
EndFunc
Link to comment
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
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...