Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <ButtonConstants.au3>
- #include <ComboConstants.au3>
- #include <Constants.au3>
- #include <EditConstants.au3>
- #include <GUIConstantsEx.au3>
- #include <Misc.au3>
- #include <StaticConstants.au3>
- #include <WindowsConstants.au3>
- #include <TabConstants.au3>
- If _Singleton("Najeeb Drive Icon Changer", 1) = 0 Then
- MsgBox(16, "Warning", "Najeeb Drive Icon Changer is already running.", 5)
- Exit
- EndIf
- #Region Main GUI
- DirCreate(@AppDataDir & "\Data\Najeeb Drive Icon Changer\Icons")
- FileInstall("MainIcon.ico", @AppDataDir & "\Data\Najeeb Drive Icon Changer\Icons\MainIcon.ico", 1)
- DirCreate(@AppDataDir & "\Data\Najeeb Drive Icon Changer\Images")
- $AppTitle = "Najeeb Drive Icon Changer"
- $YS_DIcon_Changer = GUICreate($AppTitle, 349, 285, -1, -1, $WS_SYSMENU)
- ;About button
- $btnAbout = GUICtrlCreateButton("!", 320, 0, 20, 20)
- GUICtrlSetCursor(-1, 0)
- GUICtrlSetTip(-1, "About...", "", $TIP_NOICON, $TIP_BALLOON)
- ; Group
- $Group1 = GUICtrlCreateGroup("", 8, 16, 329, 177)
- ;Label Chose Icon
- $LblIconChose = GUICtrlCreateLabel("Chose Icon", 24, 26, 58, 17)
- ;Input Icon Location
- $NputIconLocation = GUICtrlCreateInput("", 24, 46, 241, 21)
- ;Browse Icon Button
- $btnIconBrowse = GUICtrlCreateButton("...", 272, 44, 57, 25)
- GUICtrlSetFont(-1, 12, 800, 0, "Arial")
- GUICtrlSetCursor(-1, 0)
- GUICtrlSetTip(-1, "Browse Icon...", "", $TIP_NOICON, $TIP_BALLOON)
- ;Label Chose Drives
- $LblChoseDrive = GUICtrlCreateLabel("Chose Drive", 25, 79, 62, 17)
- ;Drives Latters ComboBox
- Local $CboDLatter = GUICtrlCreateCombo("", 24, 104, 121, 25, BitOR($CBS_DROPDOWN,$CBS_AUTOHSCROLL))
- GUICtrlCreateGroup("", -99, -99, 1, 1)
- GUICtrlSetData($CboDLatter, "A|B|C|D|E|F|G|H|I|J|K|L|M|N|O|P|Q|R|S|T|U|V|W|X|Y|Z", "D")
- ;IconImage
- $IconPic = GUICtrlCreateIcon(@AppDataDir & "\Data\Najeeb Drive Icon Changer\Icons\MainIcon.ico", 0, 230, 90, 90, 90)
- ; Restore Default Button
- $btnRestore = GUICtrlCreateButton("Restore Default", 16, 208, 105, 41)
- GUICtrlSetCursor(-1, 0)
- GUICtrlSetTip(-1, "Restore Default Icon...", "", $TIP_NOICON, $TIP_BALLOON)
- ; Change Drive Icon Button
- $btnChange = GUICtrlCreateButton("Change Drive Icon", 230, 208, 105, 41)
- GUICtrlSetCursor(-1, 0)
- GUICtrlSetTip(-1, "Change Icon...", "", $TIP_NOICON, $TIP_BALLOON)
- GUISetState(@SW_SHOW)
- #EndRegion
- While 1
- $nMsg = GUIGetMsg()
- Switch $nMsg
- Case $GUI_EVENT_CLOSE
- Exit
- Case $btnIconBrowse
- $icoopen = FileOpenDialog("Choose an icon file", @DesktopDir, "Icon (*.ico)", 1)
- GUICtrlSetData($NputIconLocation, $icoopen)
- GUICtrlCreateIcon($icoopen, 0,230, 90, 90, 90)
- GUICtrlCreateIcon(@AppDataDir & "\Data\Najeeb Drive Icon Changer\Icons\MainIcon.ico", 0, 230, 90, 90, 90)
- Case $btnChange
- $IconPath = GUICtrlRead($NputIconLocation)
- If $IconPath = "" Then
- MsgBox(16, "Icon is not found ..", "Please choose a icon ..")
- Else
- $DriveLatter = GUICtrlRead($CboDLatter,0)
- FileDelete(@AppDataDir & "\Data\Najeeb Drive Icon Changer\Icons\" & $DriveLatter & ".ico")
- RegDelete("HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\DriveIcons\"& $DriveLatter)
- Sleep(200)
- $BackupIcon = @AppDataDir & "\Data\Najeeb Drive Icon Changer\Icons\" & $DriveLatter & ".ico"
- RegWrite("HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\DriveIcons\"& $DriveLatter & "\DefaultIcon", "", "REG_SZ", $IconPath)
- MsgBox(64, "Complete", "Drive Icon is successfully changed. Thank for using my program.", 10)
- EndIf
- Case $btnRestore
- $DriveLatter = GUICtrlRead($CboDLatter,0)
- RegDelete("HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\DriveIcons\"& $DriveLatter)
- MsgBox(64, "Complete", "Drive Icon is now default Icon. Thank for using my program.", 10)
- Case $btnAbout
- _AboutGUI()
- EndSwitch
- WEnd
- Func _AboutGUI()
- GUISetState(@SW_DISABLE)
- Local $Aboutdlg = GUICreate("About", 302, 195, -1, -1, $WS_SYSMENU, $WS_EX_TOPMOST)
- GUISetBkColor(0xFFFFFF)
- FileInstall("AboutIcon.ico", @AppDataDir & "\Data\Najeeb Drive Icon Changer\Icons\AbutIcon.ico")
- FileInstall("N.jpg", @AppDataDir & "\DataNajeeb Drive Icon Changer\Images\N.jpg")
- GUISetIcon(@AppDataDir & "\Data\Najeeb Drive Icon Changer\Icons\AbutIcon.ico")
- $PicYawStar = GUICtrlCreatePic(@AppDataDir & "\Data\Najeeb Drive Icon Changer\Images\N.jpg", 8, 3, 55, 55)
- $Label2 = GUICtrlCreateLabel("Najeeb Drive Icon Changer", 70, 8, 255, 23)
- GUICtrlSetFont(-1, 12, 800, 0, "Leelawadee")
- $Label3 = GUICtrlCreateLabel("Najeeb software Corporation ©2022", 152, 144, 145, 18)
- GUICtrlSetFont(-1, 8, 400, 0, "Leelawadee")
- $Label1 = GUICtrlCreateLabel("Version 2.0", 116, 32, 69, 19)
- GUICtrlSetFont(-1, 10, 400, 0, "Leelawadee")
- $Label6 = GUICtrlCreateLabel("Thank you for using my software. Send E-mail", 49, 96, 206, 18)
- GUICtrlSetFont(-1, 8, 400, 0, "Leelawadee")
- $Label7 = GUICtrlCreateLabel("to najeebshahkhan@gmail.com if you have any suggestion.", 49, 108, 208, 26)
- GUICtrlSetFont(-1, 8, 400, 0, "Leelawadee")
- GUISetState(@SW_SHOW)
- While 1
- $nMsg = GUIGetMsg()
- Switch $nMsg
- Case $GUI_EVENT_CLOSE
- Local $Aboutdlg
- WinActivate("Najeeb Drive Icon Changer")
- GUIDelete($Aboutdlg)
- GUISetState(@SW_ENABLE)
- ExitLoop
- EndSwitch
- WEnd
- EndFunc ;==>_AboutGUI
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement