 |
AutoHotkey Community Let's help each other out
|
| View previous topic :: View next topic |
| Author |
Message |
PickIconDlg Guest
|
Posted: Sat Feb 17, 2007 9:41 am Post subject: Call PickIconDlg (the icon select dialog) |
|
|
| How can i call this ? Anyone with an example script .. |
|
| Back to top |
|
 |
Guest
|
Posted: Sat Feb 17, 2007 5:38 pm Post subject: |
|
|
| Anyone ?? help please.. |
|
| Back to top |
|
 |
Zipp() Guest
|
Posted: Sat Feb 17, 2007 7:44 pm Post subject: |
|
|
This seems to work:
| Code: | 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. |
|
| Back to top |
|
 |
Zippo() Guest
|
Posted: Sat Feb 17, 2007 8:05 pm Post subject: |
|
|
Nvm, IconPath isn't getting updated.
Always hated working with Dlls from AHK
I'll play with it some more  |
|
| Back to top |
|
 |
Sean
Joined: 12 Feb 2007 Posts: 1141
|
Posted: Sun Feb 18, 2007 12:41 am Post subject: |
|
|
Try this:
| Code: |
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
|
|
|
| Back to top |
|
 |
Zippo() Guest
|
Posted: Sun Feb 18, 2007 1:38 am Post subject: |
|
|
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  |
|
| Back to top |
|
 |
PickIconDlg Guest
|
Posted: Sun Feb 18, 2007 10:58 am Post subject: |
|
|
| Sean wrote: | Try this:
| Code: |
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  |
|
| Back to top |
|
 |
PickIconDlg Guest
|
Posted: Sun Feb 18, 2007 10:59 am Post subject: |
|
|
| BTW, why the Gui Show line ? |
|
| Back to top |
|
 |
PickIconDlg again Guest
|
Posted: Sun Feb 18, 2007 11:01 am Post subject: |
|
|
Oh.. to get the window handle... but the script works without that  |
|
| Back to top |
|
 |
ladiko
Joined: 14 Jul 2006 Posts: 167 Location: Berlin
|
Posted: Wed Mar 12, 2008 12:01 pm Post subject: |
|
|
| Code: | If !DllCall("shell32\PickIconDlg" , "Uint" , hWnd , "str" , wSourceFile , "Uint" , 260 , "intP" , nIndex)
Return ; cancel was clicked or something else failed |
|
|
| Back to top |
|
 |
|
|
You can post new topics in this forum You can reply to topics in this forum
|
Powered by phpBB © 2001, 2005 phpBB Group
|