How can i call this ? Anyone with an example script ..
Call PickIconDlg (the icon select dialog)
Started by
PickIconDlg
, Feb 17 2007 08:41 AM
11 replies to this topic
#1
-
Posted 17 February 2007 - 08:41 AM
This seems to work:
I didn't test it with anything but Shell32.dll tho, so might want do test it well.
Gui, Show, h100 w100, Test ;Simple GUI for a handle WinGet, hWnd, ID, Test ;Get hWnd to window IconPath = %A_WinDir%Shell32\Shell32.dll ;Path to any Dll PathSize := StrLen(IconPath) ;Length of the path above Index := 1 ;Pre-selected icon number Dlg := DllCall("Shell32.dll\PickIconDlg", "UInt", hWnd, "UInt*", "IconPath", "UInt", "PathSize", "Int*", Index) If !Dlg { MsgBox Call Failed! ExitApp } ;--- On return, IconPath will hold the Path\Dll name and Index will hold the icon number MsgBox Icon Path: %IconPath%`nIcon Selected: %Index%
I didn't test it with anything but Shell32.dll tho, so might want do test it well.
#3
-
Posted 17 February 2007 - 06:44 PM
Nvm, IconPath isn't getting updated.
Always hated working with Dlls from AHK
I'll play with it some more
Always hated working with Dlls from AHK
I'll play with it some more
#4
-
Posted 17 February 2007 - 07:05 PM
Try this:
Gui, Show, h100 w100, PickIconDlg WinGet, hWnd, ID, PickIconDlg sIconPath := A_WinDir . "\system32\shell32.dll" nIndex := 0 VarSetCapacity(wIconPath, 260 * 2) DllCall("MultiByteToWideChar", "Uint", 0, "Uint", 0, "str", sIconPath, "int", -1, "str", wIconPath, "int", 260) DllCall("shell32\PickIconDlg", "Uint", hWnd, "str", wIconPath, "Uint", 260, "intP", nIndex) VarSetCapacity(sIconPath, 260) DllCall("WideCharToMultiByte", "Uint", 0, "Uint", 0, "str", wIconPath, "int", -1, "str", sIconPath, "int", 260, "Uint", 0, "Uint", 0) MsgBox % sIconPath . "," . nIndex
#5
-
Posted 17 February 2007 - 11:41 PM
Glad you posted that. I was about to put my shoes on and go looking for Bill Gates after I did all the Unicode stuff and it wouldn't work on paths with spaces
#6
-
Posted 18 February 2007 - 12:38 AM
Try this:
Gui, Show, h100 w100, PickIconDlg WinGet, hWnd, ID, PickIconDlg sIconPath := A_WinDir . "\system32\shell32.dll" nIndex := 0 VarSetCapacity(wIconPath, 260 * 2) DllCall("MultiByteToWideChar", "Uint", 0, "Uint", 0, "str", sIconPath, "int", -1, "str", wIconPath, "int", 260) DllCall("shell32\PickIconDlg", "Uint", hWnd, "str", wIconPath, "Uint", 260, "intP", nIndex) VarSetCapacity(sIconPath, 260) DllCall("WideCharToMultiByte", "Uint", 0, "Uint", 0, "str", wIconPath, "int", -1, "str", sIconPath, "int", 260, "Uint", 0, "Uint", 0) MsgBox % sIconPath . "," . nIndex
THANKS VERY MUCH Sean
#7
-
Posted 18 February 2007 - 09:58 AM
Oh.. to get the window handle... but the script works without that
#9
-
Posted 18 February 2007 - 10:01 AM
If !DllCall("shell32\PickIconDlg" , "Uint" , hWnd , "str" , wSourceFile , "Uint" , 260 , "intP" , nIndex) Return ; cancel was clicked or something else failed
#10
-
Posted 12 March 2008 - 11:01 AM
If you don't want to deal with the random blank window, you CAN specify null as the hWnd, just like in the Win32 API:
sIconPath := A_WinDir . "\system32\shell32.dll" nIndex := 0 VarSetCapacity(wIconPath, 260 * 2) DllCall("MultiByteToWideChar", "Uint", 0, "Uint", 0, "str", sIconPath, "int", -1, "str", wIconPath, "int", 260) DllCall("shell32\PickIconDlg", "Uint", null, "str", wIconPath, "Uint", 260, "intP", nIndex) VarSetCapacity(sIconPath, 260) DllCall("WideCharToMultiByte", "Uint", 0, "Uint", 0, "str", wIconPath, "int", -1, "str", sIconPath, "int", 260, "Uint", 0, "Uint", 0) MsgBox % sIconPath . "," . nIndex
#11
-
Posted 25 August 2009 - 02:50 PM
Why are you bringing up this old topic?
In general, I would point to majkinetor's excellent Dlg module: <!-- m -->http://www.autohotke...pic.php?t=17230<!-- m -->
It directly handles the icon box code for you.
In general, I would point to majkinetor's excellent Dlg module: <!-- m -->http://www.autohotke...pic.php?t=17230<!-- m -->
It directly handles the icon box code for you.
#12
-
Posted 25 August 2009 - 02:53 PM