I'm your fan
your all functions perfect
I'm so good
autohoykey FileSelectFolder uncomfortable
FileSelectFolder The new vista dialog style Please make
member just me please
Re: member just me please
Hi,
I've absolutely no problem with FileSelectFolder. The Vista+ dialog would require an implemantation of the Common Item Dialog. That's COM, and COM isn't my preferred playground. But maybe some other member will do it or has done it already.
I've absolutely no problem with FileSelectFolder. The Vista+ dialog would require an implemantation of the Common Item Dialog. That's COM, and COM isn't my preferred playground. But maybe some other member will do it or has done it already.
Re: member just me please
thanks for reading
Re: member just me please
Well, it turned out to be not that difficult as I expected. Here's a minimum implementation, seemingly working:
Code: Select all
SelectFolder() {
; Common Item Dialog -> msdn.microsoft.com/en-us/library/bb776913%28v=vs.85%29.aspx
; IFileDialog -> msdn.microsoft.com/en-us/library/bb775966%28v=vs.85%29.aspx
; IShellItem -> msdn.microsoft.com/en-us/library/bb761140%28v=vs.85%29.aspx
Static OsVersion := DllCall("GetVersion", "UChar")
Static Show := A_PtrSize * 3
Static SetOptions := A_PtrSize * 9
Static GetResult := A_PtrSize * 20
SelectedFolder := ""
If (OsVersion < 6) { ; IFileDialog requires Win Vista+
FileSelectFolder, SelectedFolder
Return SelectedFolder
}
If !(FileDialog := ComObjCreate("{DC1C5A9C-E88A-4dde-A5A1-60F82A20AEF7}", "{42f85136-db7e-439c-85f1-e4075d135fc8}"))
Return ""
VTBL := NumGet(FileDialog + 0, "UPtr")
DllCall(NumGet(VTBL + SetOptions, "UPtr"), "Ptr", FileDialog, "UInt", 0x00000028, "UInt") ; FOS_NOCHANGEDIR | FOS_PICKFOLDERS
If !DllCall(NumGet(VTBL + Show, "UPtr"), "Ptr", FileDialog, "Ptr", 0, "UInt") {
If !DllCall(NumGet(VTBL + GetResult, "UPtr"), "Ptr", FileDialog, "PtrP", ShellItem, "UInt") {
GetDisplayName := NumGet(NumGet(ShellItem + 0, "UPtr"), A_PtrSize * 5, "UPtr")
If !DllCall(GetDisplayName, "Ptr", ShellItem, "UInt", 0x80028000, "PtrP", StrPtr) ; SIGDN_DESKTOPABSOLUTEPARSING
SelectedFolder := StrGet(StrPtr, "UTF-16"), DllCall("Ole32.dll\CoTaskMemFree", "Ptr", StrPtr)
ObjRelease(ShellItem)
}
}
ObjRelease(FileDialog)
Return SelectedFolder
}
Re: member just me please
hi just me
I can never thank you enough
Couldn't be better
You're the best!
thank you so much
Please be happy always!
I can never thank you enough
Couldn't be better
You're the best!
thank you so much
Please be happy always!
Re: member just me please
my windows 10 Pro x64
It works perfectly
by any chance Prompt title ?
Okay Thanks just me
It works perfectly
by any chance Prompt title ?
Okay Thanks just me
Re: member just me please
This seems to set the title.
Here's the vtable offsets for the other methods.
Code: Select all
SelectFolder("My Title")
SelectFolder(Title:="") {
; Common Item Dialog -> msdn.microsoft.com/en-us/library/bb776913%28v=vs.85%29.aspx
; IFileDialog -> msdn.microsoft.com/en-us/library/bb775966%28v=vs.85%29.aspx
; IShellItem -> msdn.microsoft.com/en-us/library/bb761140%28v=vs.85%29.aspx
Static OsVersion := DllCall("GetVersion", "UChar")
Static Show := A_PtrSize * 3
Static SetOptions := A_PtrSize * 9
Static SetTitle := A_PtrSize * 17
Static GetResult := A_PtrSize * 20
SelectedFolder := ""
If (OsVersion < 6) { ; IFileDialog requires Win Vista+
FileSelectFolder, SelectedFolder
Return SelectedFolder
}
If !(FileDialog := ComObjCreate("{DC1C5A9C-E88A-4dde-A5A1-60F82A20AEF7}", "{42f85136-db7e-439c-85f1-e4075d135fc8}"))
Return ""
VTBL := NumGet(FileDialog + 0, "UPtr")
DllCall(NumGet(VTBL + SetOptions, "UPtr"), "Ptr", FileDialog, "UInt", 0x00000028, "UInt") ; FOS_NOCHANGEDIR | FOS_PICKFOLDERS
If (Title != "")
DllCall(NumGet(VTBL + SetTitle, "UPtr"), "Ptr", FileDialog, "Str", Title, "UInt")
If !DllCall(NumGet(VTBL + Show, "UPtr"), "Ptr", FileDialog, "Ptr", 0, "UInt") {
If !DllCall(NumGet(VTBL + GetResult, "UPtr"), "Ptr", FileDialog, "PtrP", ShellItem, "UInt") {
GetDisplayName := NumGet(NumGet(ShellItem + 0, "UPtr"), A_PtrSize * 5, "UPtr")
If !DllCall(GetDisplayName, "Ptr", ShellItem, "UInt", 0x80028000, "PtrP", StrPtr) ; SIGDN_DESKTOPABSOLUTEPARSING
SelectedFolder := StrGet(StrPtr, "UTF-16"), DllCall("Ole32.dll\CoTaskMemFree", "Ptr", StrPtr)
ObjRelease(ShellItem)
}
}
ObjRelease(FileDialog)
Return SelectedFolder
}
Code: Select all
IFileDialog vtable offsets
0 QueryInterface
1 AddRef
2 Release
3 Show
4 SetFileTypes
5 SetFileTypeIndex
6 GetFileTypeIndex
7 Advise
8 Unadvise
9 SetOptions
10 GetOptions
11 SetDefaultFolder
12 SetFolder
13 GetFolder
14 GetCurrentSelection
15 SetFileName
16 GetFileName
17 SetTitle
18 SetOkButtonLabel
19 SetFileNameLabel
20 GetResult
21 AddPlace
22 SetDefaultExtension
23 Close
24 SetClientGuid
25 ClearClientData
26 SetFilter
Re: member just me please
Hi Kon
I owe you thanks
I owe you thanks
Re: member just me please
IFileDialog::SetTitle wrote:LPCWSTR pszTitle
Code: Select all
DllCall(NumGet(VTBL + SetTitle, "UPtr"), "Ptr", FileDialog, "WStr", Title, "UInt")
Re: member just me please
Thanks for the correction just me. The sad thing is I know that all COM strings should be Unicode. There's a lot to keep track of, and I need more practice with DllCall data types. 
raylan, Because of the incorrect string type, my code above would not work on ANSI versions of AHK.

raylan, Because of the incorrect string type, my code above would not work on ANSI versions of AHK.
- Delta Pythagorean
- Posts: 619
- Joined: 13 Feb 2017, 13:44
- GitHub: DelPyth
- Location: Somewhere in the US
Re: member just me please
Ok, old topic, I know.
But I'd like to get this dialog to be a "child" to an AHK made Gui, know of any way? I've tried the DllCall SetParent, I've Tried Gui, +OwnDialogs nothing worked...
I haven't found a solution in the Microsoft docs either. I'm completely stumped :s
But I'd like to get this dialog to be a "child" to an AHK made Gui, know of any way? I've tried the DllCall SetParent, I've Tried Gui, +OwnDialogs nothing worked...
I haven't found a solution in the Microsoft docs either. I'm completely stumped :s
[AHK]......: v2.0-rc.2 | 64-bit
[OS].......: Windows 10.0.19044.2251
[GITHUB]...: github.com/DeltaPyth
[PAYPAL]...: paypal.me/DelPyth
[DISCORD]..: tophatcat#3703
You should maybe start to migrate to v2. Practice with small features first!
Remember to use [code] ... [/code] for your multi-line scripts.
Re: member just me please
When creating your GUI, make sure to tell AutoHotkey to save its HWND to a variable.Delta Pythagorean wrote:Ok, old topic, I know.
But I'd like to get this dialog to be a "child" to an AHK made Gui, know of any way? I've tried the DllCall SetParent, I've Tried Gui, +OwnDialogs nothing worked...
I haven't found a solution in the Microsoft docs either. I'm completely stumped :s
You can then change SelectFolder() { to SelectFolder(hwndOwner := 0) { and DllCall(NumGet(VTBL + Show, "UPtr"), "Ptr", FileDialog, "Ptr", 0, "UInt") into DllCall(NumGet(VTBL + Show, "UPtr"), "Ptr", FileDialog, "Ptr", hwndOwner, "UInt").
Pass said HWND when calling SelectFolder and it should be OK. Documentation on the Show method can be found here: https://msdn.microsoft.com/en-us/librar ... s.85).aspx
- Delta Pythagorean
- Posts: 619
- Joined: 13 Feb 2017, 13:44
- GitHub: DelPyth
- Location: Somewhere in the US
Re: member just me please
jeuneperkersauvage wrote:Or just use https://autohotkey.com/boards/viewtopic.php?f=6&t=18939
Thank you both very much! It's greatly appreciated!jeuneperkersauvage wrote:https://autohotkey.com/boards/posting.p ... postingbox
[AHK]......: v2.0-rc.2 | 64-bit
[OS].......: Windows 10.0.19044.2251
[GITHUB]...: github.com/DeltaPyth
[PAYPAL]...: paypal.me/DelPyth
[DISCORD]..: tophatcat#3703
You should maybe start to migrate to v2. Practice with small features first!
Remember to use [code] ... [/code] for your multi-line scripts.
Who is online
Users browsing this forum: Descolada, william_ahk and 49 guests