There is a post by the author of the software, at the Super User link, that states:
I have developed a 64-bit shell extension that gets registered as a context menu handler.
...
Put the DLL somewhere accessible to all users, that folder you just made is a good choice. Open an admin prompt in the folder containing the DLL and do regsvr32 ContextIcons.dll.
Thus, what I see is that you have to install the shell extension. Once installed the shell extension will 'do all the work'. So that's it, you install the shell extension, and it works, and no code is required after that point.
However, it may be possible to rewrite that shell extension using AutoHotkey. I'd be interested to know if anyone on the forum has done much with shell extensions. It's one of the few key issues I haven't seen much progress on, e.g. select multiple icons in an Explorer window, and apply a right-click context menu action to them.
Btw apologies but I don't like playing around with things that affect the shell, unless I have a duff computer for testing, which I don't, unfortunately.
Btw thanks for the post, I didn't know that these icons can be set.
Btw have you installed this software yourself?
Yeah, I know what it's like when you get one of these burning questions.
==================================================
SHELL EXTENSIONS, ANYONE?
Also even this recent question, relates to a shell extension, getting a 'Properties' dialog for multiple selected files (or if possible directly getting a 'Properties' dialog for a list of files).
summarize total size property box - AutoHotkey Community
https://autohotkey.com/boards/viewtopic.php?f=5&t=30483
DOES ANYBODY KNOW ABOUT AHK + SHELL EXTENSIONS? PRETTY PLEASE?
(I don't have any experience with this.)
No responses for:
Shell extension to show cover icons of media files? - AutoHotkey Community
https://autohotkey.com/boards/viewtopic.php?t=11533
Creating a DLL Shell Extension with AutoHotkey? - AutoHotkey Community
https://autohotkey.com/boards/viewtopic.php?t=11895
==================================================
NOTES ON MENUS
[EDIT:] (I'll check for code to see if internal/external menu icons can be changed 'live'.)
I would recommend starting off by trying to set menu icons for internal menus (i.e. menus that are created by AutoHotkey). Try the example in the link below (try AHK x32 if you normally use AHK x64 and it doesn't work.)
Menu Icons v2 - Scripts and Functions - AutoHotkey Community
https://autohotkey.com/board/topic/20253-menu-icons-v2/
==================================================
RETRIEVING ICONS/IMAGES FROM FILES
Apologies for such a basic starting point, I will post more when I have the chance:
[EDIT: added a bit more since]
Code: Select all
q::
;LR_DEFAULTSIZE := 0x40 ;LR_LOADFROMFILE := 0x10
;IMAGE_ICON := 1
;vPath = %A_Desktop%\MyIcon.ico
;hIcon := DllCall("LoadImage", Ptr,0, Str,vPath, UInt,1, Int,0, Int,0, UInt,0x50, Ptr)
;IMAGE_BITMAP := 0
;vPath = %A_Desktop%\MyImage.bmp
;hBitmap := DllCall("LoadImage", Ptr,0, Str,vPath, UInt,0, Int,0, Int,0, UInt,0x50, Ptr)
;oddly, LoadPicture needs a ByRef output var in order to set an hIcon rather than an hBitmap
hIcon := LoadPicture(A_AhkPath, "", vType)
;set window icons
WinGet, hWnd, ID, A
SendMessage, 0x80, 0, % hIcon, , % "ahk_id " hWnd ;WM_SETICON ;sets title bar icon + taskbar icon
SendMessage, 0x80, 1, % hIcon, , % "ahk_id " hWnd ;WM_SETICON ;sets alt+tab icon
return
I couldn't get AutoHotkey's LoadPicture function to work in the past. I searched for 'LoadPicture(A_AhkPath' just in case, got lucky, and now I realise that it needs a ByRef output variable to be specified, to allow it to not assume an hBitmap is wanted, and instead allow it to autodetect the image type, in this case an icon. No wonder I didn't realise what was going on!
hIcon := LoadPicture(A_AhkPath, "", vType)
Code: Select all
q:: ;various ways to retrieve/set icons
WinGet, hWnd, ID, A
;use NirSoft IconsExtract to retrieve icon numbers
vPath := "shell32.dll", vNum := 28 ;shutdown icon
vPath := A_AhkPath, vNum := 160 ;ahk file icon
hModule := DllCall("LoadLibrary", Str,vPath)
;LR_DEFAULTSIZE := 0x40 ;LR_LOADFROMFILE := 0x10
;IMAGE_CURSOR := 2 ;IMAGE_ICON := 1 ;IMAGE_BITMAP := 0
hIcon := DllCall("LoadImage", Ptr,hModule, Ptr,vNum, UInt,1, Int,0, Int,0, UInt,0x40, Ptr)
;LoadImage supersedes LoadIcon, however, I'm not sure if this is doable with LoadImage instead:
;IDI_APPLICATION := 32512 ;standard exe icon
;hIcon := DllCall("LoadIcon", Ptr,0, Ptr,32512)
;use hIcon := 0 to restore the window's original icon
;hIcon := 0
;create a blank icon
;classic AutoHotkey moment:
;Remove titlebar icon without using -SysMenu or +ToolWindow - Ask for Help - AutoHotkey Community
;https://autohotkey.com/board/topic/30783-remove-titlebar-icon-without-using-sysmenu-or-toolwindow/#entry207998
;VarSetCapacity(AndMask, 32*4, 0xFF), VarSetCapacity(XorMask, 32*4, 0)
;hIcon := DllCall("CreateCursor", Ptr,0, Int,0, Int,0, Int,32, Int,32, UInt,&AndMask, UInt,&XorMask)
SendMessage, 0x80, 0, % hIcon, , % "ahk_id " hWnd ;WM_SETICON ;sets title bar icon + taskbar icon
SendMessage, 0x80, 1, % hIcon, , % "ahk_id " hWnd ;WM_SETICON ;sets alt+tab icon
DllCall("FreeLibrary", Ptr,hModule)
return
==================================================
ALT+SPACE MENU (SYSTEM MENU) ICONS AND TITLE BAR BUTTONS
[EDIT:] I couldn't remember last night where the alt+space menu icons (restore/minimize/maximize/close) were kept, couldn't find it online easily, then today I remembered, it was a font beginning with 'm', Marlett, on Windows 7: you can view it in Character Map, or open C:\Windows\Fonts\marlett.ttf.
It's possible to do text to image via Gdip_TextToGraphics, but if I wanted to clone the alt+space menu (system menu) icons, I'd want it to be perfect, so I'd probably need some other knowledge to do it. Ideally I'd do it in the same way Windows does.
I'm not sure if there was/is a way to set a menu item to have one of the default alt+space menu icons.
[EDIT:]
MENUITEMINFO structure (Windows)
https://msdn.microsoft.com/en-us/librar ... s.85).aspx
;HBMMENU_SYSTEM := 1
;HBMMENU_MBAR_RESTORE := 2
;HBMMENU_MBAR_MINIMIZE := 3
;HBMMENU_MBAR_CLOSE := 5
;HBMMENU_MBAR_CLOSE_D := 6
;HBMMENU_MBAR_MINIMIZE_D := 7
;HBMMENU_POPUP_CLOSE := 8
;HBMMENU_POPUP_RESTORE := 9
;HBMMENU_POPUP_MAXIMIZE := 10
;HBMMENU_POPUP_MINIMIZE := 11
This script allows you to change which menu items the alt+space menu has (add in custom menu items):
System Menu : Add custom and/or remove standard items - AutoHotkey Community
https://autohotkey.com/boards/viewtopic.php?f=6&t=1060
In Windows XP, the main title bar button images are kept here:
C:\WINDOWS\Resources\Themes\Luna\luna.msstyles
You can view the images inside the file with Resource Hacker.
[EDIT:] This is great, I've recaptured all my old knowledge about icons, and it wasn't easy!
==================================================
CONVERTING BITMAPS TO ICONS, ICONS TO BITMAPS
(AND EXTRACTING ICON IMAGES FROM THE SYSTRAY)
[the function here converts bitmaps to icons]
[Function] Resize and Convert Images - AutoHotkey Community
https://autohotkey.com/boards/viewtopic ... 093#p14093
[this link covers icons to bitmaps, and extracting icons from the systray]
[they may not be needed for this script, but experience dictates you should investigate related problems as you go along]
[SOLVED]Extract programs icon in systray - Ask for Help - AutoHotkey Community
https://autohotkey.com/board/topic/7624 ... n-systray/