#Region ;**** Directives created by AutoIt3Wrapper_GUI **** #AutoIt3Wrapper_Icon=Projet3.ico #AutoIt3Wrapper_Outfile=SlidingToolbar.exe #AutoIt3Wrapper_Outfile_x64=SlidingToolbar.exe #AutoIt3Wrapper_Compression=4 #AutoIt3Wrapper_UseUpx=y ; compiling, i get "Packed 1 file: 0 ok, 1 error" so i updated to x64 upx version 5.0.1.0 #AutoIt3Wrapper_UseX64=y #AutoIt3Wrapper_Res_Comment=Sliding Toolbar on the Left side of the Screen for an easy acces to your Folders, Softwares, etc... #AutoIt3Wrapper_Res_Description=Sliding Toolbar #AutoIt3Wrapper_Res_Fileversion=1.0.0.5 #AutoIt3Wrapper_Res_ProductVersion=1.0.0.5 #AutoIt3Wrapper_Res_LegalCopyright=wakillon 2025 #AutoIt3Wrapper_Res_requestedExecutionLevel=asInvoker #AutoIt3Wrapper_Res_Field=Credits|Based on a Hest script (https://www.autoitscript.com/forum/topic/96770-another-toolbar) and modified by wakillon #AutoIt3Wrapper_Res_Field=Compiled with | AutoIt Version 3.3.18.0 #AutoIt3Wrapper_Res_Field=AutoIt Version|%AutoItVer% #AutoIt3Wrapper_Res_Field=Compile date|%longdate% %time% #AutoIt3Wrapper_Run_After=del "%scriptfile%_stripped.au3" #AutoIt3Wrapper_Run_Au3Stripper=y #Au3Stripper_Parameters=/so /pe /rm #EndRegion ;**** Directives created by AutoIt3Wrapper_GUI **** #Region ;************ Includes ************ #Region ;************ Includes ************ #Include #Include #include #include #Include #Include #Include #Include #Include #Include #EndRegion ;************ Includes ************ Opt('MustDeclareVars', 1) #Region ------ Global Variables ------------------------------ Global $iButtonsCount = 21 Global $iButtonsRow = 3 Global $iButtonWidth = 60 Global $iButtonHeight = 32 Global $iButtonDistx = 8 Global $iButtonDisty = 8 Global $iGuiPartVisible = 5 ; px Global $iShowWindow = 0 Global $iTransparency = 210 Global $iButtonsPerRow = Ceiling($iButtonsCount/$iButtonsRow), $iButtonsCount = $iButtonsPerRow*$iButtonsRow Global $aIdButton[$iButtonsCount+1], $aButtonId[$iButtonsCount*4] Global $iGuiWidth = ($iButtonsPerRow*$iButtonWidth)+($iButtonsPerRow*$iButtonDistx)+$iButtonDistx Global $iGuiHeight = ($iButtonsRow*$iButtonHeight)+($iButtonsRow*$iButtonDisty)+$iButtonDisty+$iGuiPartVisible +5 Global $iGuiYPos = -($iGuiHeight - $iGuiPartVisible) Global $iGuiXPos = (@DeskTopWidth / 2) - ($iGuiWidth / 2) Global $iLabelWidth = $iGuiWidth, $idMsg, $iOver, $aCursorInfo, $sFile, $iXFontSize Global $hUser32Dll, $hKernel32Dll, $hShlwapiDll, $hShell32Dll, $iAdlibTime = 500 Global $iTotalFiles, $aFileLink, $sGuiTitle = 'SlidingToolbar by wakillon', $bBeepEnable=True, $bNoTrans=True Global $aButtonMenu[$iButtonsCount+1], $aMenuDelete[$iButtonsCount+1] Global $hGui, $idLabelInfo, $idLabelExit, $sTempDir = @TempDir & '\SlidingToolBar', $sIniFilePath = $sTempDir & '\SlidingToolBar.ini' Global $sRegTitleKey = 'SlidingToolbar', $hTimerInit = TimerInit() Global $idTrayItemStartWithWindows, $idTrayItemExit, $idTrayItemMute, $idTrayItemNoTrans Global $sRegKeyStartWithWindows = 'HKCU\Software\Microsoft\Windows\CurrentVersion\Run' Global $sRegKeySettings = 'HKEY_CURRENT_USER\Software\SlidingToolbar\Settings' #EndRegion --- Global Variables ------------------------------ ConsoleWrite( '$iGuiWidth : ' & $iGuiWidth & @Crlf ) ConsoleWrite( '$iGuiHeight : ' & $iGuiHeight & @Crlf ) #Region ------ Init ------------------------------ If Not _Singleton(@ScriptName, 0) Then Exit If Not FileExists($sIniFilePath) Then _IniFileCreate() $aFileLink = IniReadSection($sIniFilePath, 'Launch') If IsArray($aFileLink) Then $iTotalFiles = $aFileLink[0][0] $hUser32Dll = DllOpen('user32.dll') $hKernel32Dll = DllOpen('kernel32.dll') $hShlwapiDll = DllOpen('shlwapi.dll') $hShell32Dll = DllOpen('shell32.dll') _Gui() AdlibRegister ( '_IsCursorOverGui', $iAdlibTime) OnAutoItExitRegister('_Exit') Opt('TrayIconHide', 0) Opt('TrayOnEventMode', 1) Opt('TrayMenuMode', 1) #EndRegion --- Init ------------------------------ #Region ------ Main Loop ------------------------------ While 1 $idMsg = GUIGetMsg() Switch $idMsg Case $idLabelExit, $idLabelInfo Exit Case $GUI_EVENT_DROPPED AdlibUnRegister('_IsCursorOverGui') _ItemAdd() AdlibRegister ( '_IsCursorOverGui', $iAdlibTime) Case $idTrayItemStartWithWindows Case $idTrayItemExit EndSwitch For $i = 1 To $iButtonsCount If $idMsg = $aIdButton[$i] Then $sFile = IniRead($sIniFilePath, 'Launch', $i, 'Empty') If FileExists($sFile) Then ShellExecute($sFile) Else MsgBox(48,'Error', 'File could not be found') EndIf EndIf Next For $i = 1 To $iButtonsCount If $idMsg = $aMenuDelete[$i] Then _ItemDelete($i) Next $iOver=0 If TimerDiff ( $hTimerInit ) > 500 Then $aCursorInfo=GUIGetCursorInfo($hGui) If Not @error Then For $i = 1 To $iButtonsCount If $aCursorInfo[4]=$aIdButton[$i] Then $sFile = IniRead($sIniFilePath, 'Launch', $i, 'Empty') If GUICtrlRead($idLabelInfo)<> _FileGetName($sFile) Then GUICtrlSetData($idLabelInfo, _FileGetName($sFile)) $iOver=1 ExitLoop EndIf Next EndIf If $iOver=0 And GUICtrlRead($idLabelInfo)<> $sGuiTitle Then GUICtrlSetData($idLabelInfo, $sGuiTitle) $hTimerInit = TimerInit() EndIf Sleep(50) WEnd #EndRegion --- Main Loop ------------------------------ Func _DesktopIniPathClean($sPath) Return _ExpandEnvironmentStringsW(StringReplace($sPath, '@', '')) EndFunc ;==> _DesktopIniPathClean() Func _DesktopIniRead($sFilepath) Local $a[2], $aDesktopIniRead = IniReadSection ( $sFilepath, '.ShellClassInfo') For $i = 0 To UBound($aDesktopIniRead) -1 If $aDesktopIniRead[$i][0] ='IconResource' Then If StringInStr($aDesktopIniRead[$i][1], ',') Then $a = StringSplit(_DesktopIniPathClean($aDesktopIniRead[$i][1]), ',', 1+2) If FileExists($a[0]) Then ExitLoop EndIf EndIf Next If Not FileExists($a[0]) Then For $i = 0 To UBound($aDesktopIniRead) -1 If $aDesktopIniRead[$i][0] ='IconFile' Then If StringInStr($aDesktopIniRead[$i][1], ',') Then $a = StringSplit(_DesktopIniPathClean($aDesktopIniRead[$i][1]), ',', 1+2) Else $a[0] = _DesktopIniPathClean($aDesktopIniRead[$i][1]) $a[1] = $aDesktopIniRead[$i+1][1] EndIf If FileExists($a[0]) Then ExitLoop EndIf Next If Not FileExists($a[0]) Then For $i = 0 To UBound($aDesktopIniRead) -1 If $aDesktopIniRead[$i][0] ='LocalizedResourceName' Then If StringInStr($aDesktopIniRead[$i][1], ',') Then $a = StringSplit(_DesktopIniPathClean($aDesktopIniRead[$i][1]), ',', 1+2) If FileExists($a[0]) Then ExitLoop EndIf EndIf Next EndIf EndIf If Not FileExists($a[0]) Then Return Return $a EndFunc ;==> _DesktopIniRead() Func _Exit() GUISetState(@SW_HIDE, $hGui) AdlibUnRegister('_IsCursorOverGui') DllClose($hShell32Dll) DllClose($hShlwapiDll) DllClose($hKernel32Dll) DllClose($hUser32Dll) GUIDelete($hGui) Exit EndFunc ;==> _Exit() Func _ExpandEnvironmentStringsW($sString) Local $aRet = DllCall($hKernel32Dll, 'dword', 'ExpandEnvironmentStringsW', 'wstr', $sString, 'wstr', '', 'dword', 4096) If @error Or Not $aRet[0] Then Return SetError(@error, @extended, '') Return $aRet[2] EndFunc ;==> _ExpandEnvironmentStringsW() Func _FileGetDefautIcon($sExtension) Local $aDefIcon[2] $aDefIcon[1] = 0 $aDefIcon[0] = _WinAPI_AssocQueryString($sExtension, $aSSOCSTR_DEFAULTICON) If Not @error Then If Not FileExists($aDefIcon[0]) Then If StringInStr($aDefIcon[0], ',') Then $aDefIcon = StringSplit(_DesktopIniPathClean($aDefIcon[0]), ',', 1+2) If Not FileExists($aDefIcon[0]) Then $aDefIcon[0] = _WinAPI_AssocQueryString($sExtension, $aSSOCSTR_EXECUTABLE) $aDefIcon[1] = 0 EndIf EndIf EndIf $aDefIcon[1] = Abs($aDefIcon[1]) If FileExists($aDefIcon[0]) Then Return $aDefIcon EndFunc ;==> _FileGetDefautIcon() Func _FileGetName($sPath) Return StringTrimRight(_PathFindFileNameW($sPath), StringLen(_PathFindExtensionW($sPath))) EndFunc ;==> _FileGetName() Func _Gui() $hGui = GUICreate($sGuiTitle, $iGuiWidth, $iGuiHeight, $iGuiXPos-8, $iGuiYPos, BiToR($WS_POPUP, $WS_GROUP, $WS_THICKFRAME, $WS_BORDER, $WS_OVERLAPPED), BiToR($WS_EX_TOPMOST, $WS_EX_TOOLWINDOW, $WS_EX_ACCEPTFILES, $WS_EX_LAYERED)) GUISetBkColor(0xABCDEF) ;~ $hGui = GUICreate($sGuiTitle, $iGuiWidth, $iGuiHeight, $iGuiXPos, $iGuiYPos, $WS_POPUP+$WS_BORDER+$WS_OVERLAPPED, BiToR($WS_EX_TOPMOST, $WS_EX_TOOLWINDOW, $WS_EX_ACCEPTFILES)) GUISetCursor(0, 1, $hGui) ;~ GUISetBkColor(0x8B8989) WinSetTrans($hGui, '', $iTransparency) GUICtrlCreateLabel('', 0, 0, $iGuiWidth, $iGuiHeight) GUICtrlSetState(-1, $GUI_DISABLE) Local $Row = 1, $j = 1, $iError, $sIniRead Local $Buttondist = $iButtonWidth+$iButtonDistx Local $NextButtonx = $iButtonDistx, $NextButtony = $iButtonDisty For $i = 1 To $iButtonsCount Step 1 $aIdButton[$i] = GUICtrlCreateButton('', $NextButtonx, $NextButtony, $iButtonWidth, $iButtonHeight, $BS_ICON) GUICtrlSetState($aIdButton[$i], $GUI_DROPACCEPTED) $aButtonId[$aIdButton[$i]] = $i $sIniRead = IniRead($sIniFilePath, 'Launch', $i, 'Empty') If FileExists($sIniRead) Then _GuiButtonsAddIcon($sIniRead, $i) ElseIf $sIniRead <> 'Empty' Then _ItemDelete($i) $iError += 1 EndIf $aButtonMenu[$i] = GUICtrlCreateContextMenu($aIdButton[$i]) $aMenuDelete[$i] = GUICtrlCreateMenuItem('Delete Item', $aButtonMenu[$i]) $NextButtonx = $NextButtonx+$Buttondist $j +=1 If $j > $iButtonsPerRow Then $NextButtonx = $iButtonDistx $NextButtony = (($iButtonHeight+$iButtonDisty)*$Row)+$iButtonDisty $Row +=1 $j = 1 EndIf Next If $iError > 0 Then MsgBox(48,'Error', $iError & ' Items could not be found And has been removed from the Toolbar') $idLabelInfo = GUICtrlCreateLabel($sGuiTitle, ($iGuiWidth/2)-$iLabelWidth/2, $iGuiHeight - 17, $iLabelWidth -10, 16, $WS_GROUP+$SS_CENTER) GUICtrlSetFont(-1, 9, 400, 0, 'Consolas') Local $Color = 0x545555 GUICtrlSetBkColor (-1, $Color) GUICtrlSetColor (-1, 0xFFFFFF) $iXFontSize=10 $idLabelExit = GUICtrlCreateLabel('X', $iGuiWidth-10, $iGuiHeight-17, $iXFontSize+4, $iXFontSize+6) GUICtrlSetFont(-1, $iXFontSize, 900, 0, 'Consolas') GUICtrlSetBkColor (-1, $Color) GUICtrlSetColor(-1, 0xFFFFFF) GUICtrlSetTip(-1, 'Click X for Exit') GUISetState() _WinAPI_SetLayeredWindowAttributes($hGui, 0xABCDEF, 255) ; Tray Menu TrayCreateItem($sGuiTitle) TrayCreateItem('') $idTrayItemNoTrans = TrayCreateItem('No Transparency') TrayItemSetOnEvent(-1, '_NoTrans') TrayCreateItem('') $idTrayItemMute = TrayCreateItem('Mute') TrayItemSetOnEvent(-1, '_Mute') TrayCreateItem('') $idTrayItemStartWithWindows = TrayCreateItem('Start With Windows') TrayItemSetOnEvent(-1, '_StartWithWindows') If RegRead ( $sRegKeySettings, 'StartWithWindows' ) =0 Or RegRead ( $sRegKeySettings, 'StartWithWindows' ) ='' Then ; when key doesn't exists yet. RegWrite ( $sRegKeySettings, 'StartWithWindows', 'REG_SZ', 0 ) TrayItemSetState ( $idTrayItemStartWithWindows, $TRAY_UNCHECKED ) Else RegWrite ( $sRegKeySettings, "StartWithWindows", "REG_SZ", 1 ) TrayItemSetState ( $idTrayItemStartWithWindows, $TRAY_CHECKED ) If RegRead($sRegKeyStartWithWindows, $sRegTitleKey)<> '' Then RegDelete($sRegKeyStartWithWindows & '\' & $sRegTitleKey) If @Compiled Then RegWrite($sRegKeyStartWithWindows, $sRegTitleKey, 'REG_SZ', '"' & @ScriptFullPath & '"') TrayItemSetState(-1, $TRAY_CHECKED) EndIf EndIf TrayCreateItem('') $idTrayItemExit = TrayCreateItem('Exit') TrayItemSetOnEvent(-1, '_Exit') If RegRead($sRegKeySettings,'NoTrans')=0 Or RegRead($sRegKeySettings,'NoTrans')='' Then $bNoTrans=False RegWrite($sRegKeySettings,'NoTrans','REG_SZ',0) TrayItemSetState($idTrayItemNoTrans,$TRAY_UNCHECKED) Else $bNoTrans=True RegWrite($sRegKeySettings,'NoTrans','REG_SZ',1) TrayItemSetState($idTrayItemNoTrans,$TRAY_CHECKED) _NoTrans() EndIf If RegRead($sRegKeySettings,'Mute')=0 Or RegRead($sRegKeySettings,'Mute')='' Then $bBeepEnable=True RegWrite($sRegKeySettings,'Mute','REG_SZ',0) TrayItemSetState($idTrayItemMute,$TRAY_UNCHECKED) Else $bBeepEnable=False RegWrite($sRegKeySettings,'Mute','REG_SZ',1) TrayItemSetState($idTrayItemMute,$TRAY_CHECKED) EndIf TraySetState($TRAY_ICONSTATE_FLASH) EndFunc;==>_Gui() Func _GuiButtonsAddIcon($sFile, $id) Local $sExtension = _PathFindExtensionW($sFile), $sIconreg, $aIconSplit, $sExtensionreg Local $sDefIcon, $sDefBrowser, $aShortcut, $aDesktopIni Switch $sExtension Case '.lnk' $aShortcut = FileGetShortcut($sFile) If Not @error Then If IsArray($aShortcut) Then MsgBox(48,'Error', '$aShortcut[0] ' & $aShortcut[0], 3) If Not FileExists($aShortcut[0]) Then MsgBox(48,'Error', 'ShortCut ' & $sFile & ' is dead', 3) Else _GuiButtonsAddIcon($aShortcut[0], $id) IniWrite($sIniFilePath, 'Launch', $id, $aShortcut[0]) EndIf EndIf Else MsgBox(48,'Error', 'ShortCut ' & $sFile & ' cant be accessed', 3) EndIf Return Case '.exe' GUICtrlSetImage($aIdButton[$id], $sFile, 0, 1) Case '.url', '.http', '.https', '.html', '.htm' $sDefBrowser = _WinAPI_AssocQueryString('https', $ASSOCSTR_EXECUTABLE, $ASSOCF_VERIFY) If FileExists($sDefBrowser) Then GUICtrlSetImage($aIdButton[$id], $sDefBrowser, 0, 1) ;~ @SystemDir & '\OpenWith.exe' ; Text files Case '.txt', '.chm', '.odt', 'odm', 'ott', '.doc', '.docx', '.pdf', '.rtf', '.wpd', '.wps', '.gdoc', '.eml', '.bat', '.cmd', '.ini', '.nfo', '.diz', '.au3', '.vbs', '.ahk', '.reg', '.h', '.c', '.cc', '.cpp', _ '.asm', '.bas', '.pas', '.py', '.pb', '.pbi', '.bi', '.frm', '.dsp', '.js', '.lua', '.properties', '.xml', '.dev', '.f', '.inl', '.layout', '.lo', '.sh', '.ps1', _ '.milk', '.plo', '.hpp', '.json', '.php', '.yaml', '.swg', '.ts', '.xd' $sDefIcon = _IconSaveDefault($sFile, $sTempDir & '\Icons') If FileExists($sDefIcon) Then GUICtrlSetImage($aIdButton[$id], $sDefIcon, 0, 1) ; Picture files Case '.jpg', '.jpeg', '.bmp', '.png', '.tiff' ; $iIndex : 127 $iIndex : 128 $iIndex : 238 GUICtrlSetImage($aIdButton[$id],_IconSaveFromDll( @SystemDir & '\shell32.dll', 127, $sTempDir & '\Icons'), -1, 1) ; Movie files Case '.avi', '.xvid', '.divx', '.mpg', '.mpeg', '.mp4', '.mkv', '.flv', '.mov', '.wmv', '.rm', '.3gp' ; $iIndex : 115, 129 $sExtensionreg = RegRead('HKEY_CLASSES_ROOT\' & $sExtension, '') $sIconreg = StringReplace(RegRead('HKEY_CLASSES_ROOT\' & $sExtensionreg & '\DefaultIcon\', ''), '"', '') $aIconSplit = StringSplit($sIconreg, ',') If Not @error Then GUICtrlSetImage($aIdButton[$id], $aIconSplit[1], Abs($aIconSplit[2]), 1) ; Music files Case '.m3u', '.m3u8', '.mp3', '.ogg', '.flac', '.midi', '.gsf', '.minigsf', '.m3up', '.sng', '.wav', '.wma', '.mod', '.xm', '.aac', '.snd' ; Music files ; $iIndex : 225 $iIndex : 237 $sExtensionreg = RegRead('HKEY_CLASSES_ROOT\' & $sExtension, '') $sIconreg = StringReplace(RegRead('HKEY_CLASSES_ROOT\' & $sExtensionreg & '\DefaultIcon\', ''), '"', '') $aIconSplit = StringSplit($sIconreg, ',') If Not @error Then GUICtrlSetImage($aIdButton[$id], $aIconSplit[1], Abs($aIconSplit[2]), 1) Case Else If _WinAPI_PathIsDirectory($sFile) Then $aDesktopIni = _DesktopIniRead($sFile & '\desktop.ini') If IsArray($aDesktopIni) Then If UBound($aDesktopIni) < 2 Then GUICtrlSetImage($aIdButton[$id], $aDesktopIni[0], 0, 0) Else GUICtrlSetImage($aIdButton[$id], _IconSaveFromDll($aDesktopIni[0], $aDesktopIni[1], $sTempDir & '\Icons'), -1, 0) EndIf Else $sIconreg = StringReplace(RegRead('HKEY_CLASSES_ROOT\Directory\DefaultIcon\', ''), '"', '') $aIconSplit = StringSplit($sIconreg, ',') If Not @error Then $aIconSplit[2] = Abs($aIconSplit[2]) GUICtrlSetImage($aIdButton[$id], $aIconSplit[1], 4) EndIf EndIf Else MsgBox(48,'Error', 'Filetype ' & $sExtension & ' is not supported', 3) _ItemDelete($id) EndIf EndSwitch EndFunc ;==> _GuiButtonsAddIcon() Func _GuiSlide() AdlibUnRegister('_IsCursorOverGui') Local $iSpeed = 5 If $iShowWindow = 0 Then WinMove($hGui, '', $iGuiXPos, 0, Default, Default, $iSpeed) $iShowWindow = 1 Else WinMove($hGui, '', $iGuiXPos, $iGuiYPos, Default, Default, $iSpeed) $iShowWindow = 0 EndIf AdlibRegister('_IsCursorOverGui') EndFunc ;==> _GuiSlide() Func _IconSaveDefault($sPath, $sSaveDir=@TempDir) If Not FileExists($sPath) Then Return SetError(1) If Not FileExists($sSaveDir) Then DirCreate($sSaveDir) Local $sIconPath = $sSaveDir & '\' & StringTrimLeft( _PathFindExtensionW($sPath), 1) & '.ico' ; ex : 'vbs.ico' If FileExists($sIconPath) Then Return $sIconPath Local $tSHFILEINFOW = DllStructCreate('handle Icon;int IconIndex;dword Attributes;wchar DisplayName[260];wchar TypeName[80]') DllCall($hShell32Dll, 'dword_ptr', 'SHGetFileInfoW', 'wstr', $sPath, 'dword', 0, 'ptr', DllStructGetPtr($tSHFILEINFOW), 'dword', DllStructGetSize($tSHFILEINFOW), 'dword', BitOR($SHGFI_ICON, $SHGFI_SYSICONINDEX, $SHGFI_USEFILEATTRIBUTES, $SHGFI_LARGEICON)) If @error Then Return SetError(2) Local $hIconNew = DllStructGetData($tSHFILEINFOW, 'Icon') Local $hIcon = _WinAPI_Create32BitHICON($hIconNew, False) If @error Then Return SetError(3) _WinAPI_SaveHICONToFile($sIconPath, $hIcon) If @error Then Return SetError(4) If $hIconNew Then _WinAPI_DestroyIcon($hIconNew) If $hIcon Then _WinAPI_DestroyIcon($hIcon) $tSHFILEINFOW=0 Return $sIconPath EndFunc ;==> _IconSaveDefault() Func _IconSaveFromDll( $sPath, $iIndex, $sSaveDir=@TempDir, $iIconSize=32) If Not FileExists($sPath) Then Return SetError(1) If Not FileExists($sSaveDir) Then DirCreate($sSaveDir) Local $sIconName = _FileGetName($sPath) Local $sIconPath = $sSaveDir & '\' & $sIconName & StringFormat('%04i', $iIndex) & '.ico' If FileExists($sIconPath) Then Return $sIconPath Local $iTotal = _WinAPI_ExtractIconEx($sPath, -1, 0, 0, 0) If Not @error And $iIndex > $iTotal Then Return SetError(2) Local $hIco = _SHExtractIconsW($sPath, $iIndex, $iIconSize, $iIconSize) If @error Then Return SetError(3) Local $hIcon = _WinAPI_Create32BitHICON($hIco, 1) If @error Then Return SetError(4) _WinAPI_SaveHICONToFile($sIconPath, $hIcon) If @error Then Return SetError(5) If $hIco Then _WinAPI_DestroyIcon($hIco) If $hIcon Then _WinAPI_DestroyIcon($hIcon) Return $sIconPath EndFunc ;==> _IconSaveFromDll() Func _IniFileCreate() If Not FileExists($sTempDir) Then DirCreate($sTempDir) IniWrite($sIniFilePath, 'Launch', 1, 'D:\') IniWrite($sIniFilePath, 'Launch', 4, @SystemDir & '\notepad.exe') IniWrite($sIniFilePath, 'Launch', 5, @SystemDir & '\calc.exe') IniWrite($sIniFilePath, 'Launch', 7, @WindowsDir & '\explorer.exe') EndFunc ;==> _IniFileCreate() Func _IsCursorOverGui() Local $aCursorInfo = GUIGetCursorInfo($hGui) If Not @error Then If $aCursorInfo[1]/$iGuiHeight < .95 Then Return If $iShowWindow = 0 And _WinGetAncestor(GUICtrlGetHandle($aCursorInfo[4])) = $hGui Then _GuiSlide() ElseIf $iShowWindow = 1 And _WinGetAncestor(GUICtrlGetHandle($aCursorInfo[4])) <> $hGui Then _GuiSlide() EndIf EndIf EndFunc ;==> _IsCursorOverGui() Func _ItemAdd() Local $id = $aButtonId[@GUI_DROPID] Local $sFile = @GUI_DRAGFILE IniWrite($sIniFilePath, 'Launch', $id, $sFile) _GuiButtonsAddIcon($sFile, $id) EndFunc ;==> _ItemAdd() Func _ItemDelete($id) IniDelete($sIniFilePath, 'Launch', $id) GUICtrlSetImage($aIdButton[$id], 'Shell32.dll', 50) GUICtrlSetTip($aIdButton[$id], '') EndFunc ;==> _ItemDelete() Func _Mute() $bBeepEnable=Not $bBeepEnable If _TrayItemIsChecked($idTrayItemMute) Then RegWrite($sRegKeySettings,'Mute','REG_SZ',1) Else RegWrite($sRegKeySettings,'Mute','REG_SZ',0) EndIf EndFunc ;==> _Mute() Func _NoTrans() If _TrayItemIsChecked($idTrayItemNoTrans) Then $bNoTrans=1 GUISetBkColor(0xFFFFFF,$hGui) RegWrite($sRegKeySettings,'NoTrans','REG_SZ',1) Else $bNoTrans=0 GUISetBkColor(0xABCDEF,$hGui) RegWrite($sRegKeySettings,'NoTrans','REG_SZ',0) EndIf GUISetState() EndFunc ;==> _NoTrans() Func _PathCompactPathW($hWnd, $sFilePath, $iWidth = 0) If $iWidth < 1 Then Local $tRECT = DllStructCreate($tagRECT) DllCall($hUser32Dll, 'bool', 'GetClientRect', 'hwnd', $hWnd, 'struct*', $tRECT) $iWidth += DllStructGetData($tRECT, 'Right') - DllStructGetData($tRECT, 'Left') EndIf Local $aRet = DllCall($hUser32Dll, 'handle', 'GetDC', 'hwnd', $hWnd) If @error Or Not $aRet[0] Then Return SetError(@error + 20, @extended, $sFilePath) Local $hDC = $aRet[0] Local Const $WM_GETFONT = 0x0031 $aRet = DllCall($hUser32Dll, 'ptr', 'SendMessage', 'hwnd', $hWnd, 'uint', $WM_GETFONT, 'wparam', 0, 'lparam', 0) Local $hBack = DllCall('gdi32.dll', 'handle', 'SelectObject', 'handle', $hDC, 'handle', $aRet[0]) Local $iError = 0 $aRet = DllCall($hShlwapiDll, 'bool', 'PathCompactPathW', 'handle', $hDC, 'wstr', $sFilePath, 'int', $iWidth) If @error Or Not $aRet[0] Then $iError = @error + 10 DllCall('gdi32.dll', 'handle', 'SelectObject', 'handle', $hDC, 'handle', $hBack[0]) DllCall($hUser32Dll, 'int', 'ReleaseDC', 'hwnd', $hWnd, 'handle', $hDC) If $iError Then Return SetError($iError, 0, $sFilePath) Return $aRet[2] EndFunc ;==> _PathCompactPathW() Func _PathFindExtensionW($sFilePath) Local $aRet = DllCall($hShlwapiDll, 'wstr', 'PathFindExtensionW', 'wstr', $sFilePath) If @error Then Return SetError(@error, @extended, '') Return $aRet[0] EndFunc ;==> _PathFindExtensionW() Func _PathFindFileNameW($sFilePath) Local $aRet = DllCall($hShlwapiDll, 'wstr', 'PathFindFileNameW', 'wstr', $sFilePath) If @error Then Return SetError(@error, @extended, $sFilePath) Return $aRet[0] EndFunc ;==> _PathFindFileNameW() Func _SHExtractIconsW($sIcon, $iIndex, $iWidth, $iHeight) Local $aRet = DllCall($hShell32Dll, 'int', 'SHExtractIconsW', 'wstr', $sIcon, 'int', $iIndex, 'int', $iWidth, 'int', $iHeight, 'ptr*', 0, 'ptr*', 0, 'int', 1, 'int', 0) If @error Or Not $aRet[0] Or Not $aRet[5] Then Return SetError(@error, @extended, 0) Return $aRet[5] EndFunc ;==> _SHExtractIconsW() Func _StartWithWindows() If @Compiled Then If TrayItemGetState(@TRAY_ID)= 1+64 Then ; $TRAY_CHECKED + $TRAY_ENABLE RegDelete('HKCU\Software\Microsoft\Windows\CurrentVersion\Run\' & $sRegTitleKey) RegWrite('HKCU\Software\Microsoft\Windows\CurrentVersion\Run', $sRegTitleKey, 'REG_SZ', '"' & @ScriptFullPath & '"') ;~ $iCloseIfSciTE = 'Off' ;~ _ReplaceStringInFile($sOptFile, 'CloseIfSciTE=On', 'CloseIfSciTE=Off') ;~ _TrayTip($sGuiTitle, $sRegTitleKey & ' is added to Windows Start !', 1) Else RegDelete('HKCU\Software\Microsoft\Windows\CurrentVersion\Run', $sRegTitleKey) ;~ _TrayTip($sGuiTitle, $sRegTitleKey & ' was removed to Windows Start !', 1) EndIf Else TrayItemSetState(@TRAY_ID, 4); $TRAY_UNCHECKED MsgBox(262144+16, 'Error', 'Script must be Compiled !' & @CRLF, 5) EndIf EndFunc ;==> _StartWithWindows() Func _TrayItemIsChecked($idCtrl) Return BitAND(TrayItemGetState($idCtrl),$TRAY_CHECKED)=$TRAY_CHECKED EndFunc ;==> _TrayItemIsChecked() Func _WinGetAncestor($hWnd, $iFlags = 1) ; $GA_PARENT Local $aRet = DllCall($hUser32Dll, 'hwnd', 'GetAncestor', 'hwnd', $hWnd, 'uint', $iFlags) If @error Then Return SetError(@error, @extended, 0) Return $aRet[0] EndFunc ;==> _WinGetAncestor()