convert function to Ansi

Get help with using AutoHotkey (v1.1 and older) and its commands and hotkeys
User avatar
DataLife
Posts: 458
Joined: 29 Sep 2013, 19:52

convert function to Ansi

03 Dec 2023, 15:59

Can someone convert this function to Ansi for me? I got this function from viewtopic.php?t=75602

Code: Select all

SHGetKnownFolderPath(FOLDERID, KF_FLAG:=0) {                  ;   By SKAN on D356 @ tiny.cc/t-75602
Local CLSID, pPath:=""                                        ; Thanks teadrinker @ tiny.cc/p286094
Return Format("{4:}", VarSetCapacity(CLSID, 16, 0)
     , DllCall("ole32\CLSIDFromString", "Str",FOLDERID, "Ptr",&CLSID)
     , DllCall("shell32\SHGetKnownFolderPath", "Ptr",&CLSID, "UInt",KF_FLAG, "Ptr",0, "PtrP",pPath)
     , StrGet(pPath, "utf-16")
     , DllCall("ole32\CoTaskMemFree", "Ptr",pPath))
}
Check out my scripts. (MyIpChanger) (ClipBoard Manager) (SavePictureAs)
All my scripts are tested on Windows 10, AutoHotkey 32 bit Ansi unless otherwise stated.
just me
Posts: 9466
Joined: 02 Oct 2013, 08:51
Location: Germany

Re: convert function to Ansi

04 Dec 2023, 06:53

Might be enough to change the parameter type to WStr:

Code: Select all

     , DllCall("ole32\CLSIDFromString", "WStr",FOLDERID, "Ptr",&CLSID)
User avatar
DataLife
Posts: 458
Joined: 29 Sep 2013, 19:52

Re: convert function to Ansi

04 Dec 2023, 10:37

just me wrote:
04 Dec 2023, 06:53
Might be enough to change the parameter type to WStr:

Code: Select all

     , DllCall("ole32\CLSIDFromString", "WStr",FOLDERID, "Ptr",&CLSID)
thanks, that worked
Check out my scripts. (MyIpChanger) (ClipBoard Manager) (SavePictureAs)
All my scripts are tested on Windows 10, AutoHotkey 32 bit Ansi unless otherwise stated.

Return to “Ask for Help (v1)”

Who is online

Users browsing this forum: vysmaty and 194 guests