SHGetPathFromIDList_ not working
-
- New User
- Posts: 5
- Joined: Sun Aug 04, 2024 11:56 pm
SHGetPathFromIDList_ not working
SHGetPathFromIDList_(Result, @Folder) does not work in the current PureBasic 6.11 LTS (Windows - x64).
It does not give me an error and just terminates the run and puts me back to the windows screen
It worked in my compiled EXE on 5/282023.
What is the new purebasic function?
Windows has SHGetPathFromIDListA and SHGetPathFromIDListW and has discontinued SHGetPathFromIDList_
It does not give me an error and just terminates the run and puts me back to the windows screen
It worked in my compiled EXE on 5/282023.
What is the new purebasic function?
Windows has SHGetPathFromIDListA and SHGetPathFromIDListW and has discontinued SHGetPathFromIDList_
Re: SHGetPathFromIDList_ not working
Do you have some code to demonstrate your problems?
Re: SHGetPathFromIDList_ not working
Can you try this code (by normeus)? Works fine for me:alphadennis wrote: Mon Aug 05, 2024 12:04 am SHGetPathFromIDList_(Result, @Folder) does not work in the current PureBasic 6.11 LTS (Windows - x64).
It does not give me an error and just terminates the run and puts me back to the windows screen
It worked in my compiled EXE on 5/282023.
What is the new purebasic function?
Windows has SHGetPathFromIDListA and SHGetPathFromIDListW and has discontinued SHGetPathFromIDList_
Code: Select all
Define Folder_ID, SFolderLoc.s
If SHGetSpecialFolderLocation_(0, #CSIDL_PROFILE, @Folder_ID) = 0
SFolderLoc.s = Space(#MAX_PATH*2)
SHGetPathFromIDList_(Folder_ID, @SFolderLoc)
CoTaskMemFree_(Folder_ID)
EndIf
Debug sFolderLoc
Re: SHGetPathFromIDList_ not working
First thing to check is if you are still using '.l' for variable which handle pointers (should be '.i' or no suffix)
-
- User
- Posts: 94
- Joined: Sun Oct 24, 2004 9:25 am
Re: SHGetPathFromIDList_ not working
That code is working fine here on 6.11 64-bit, win 11. (also tested with some other #CSIDL-Constants)firace wrote: Mon Aug 05, 2024 7:40 amCan you try this code (by normeus)? Works fine for me:
Note: I'm still running 6.03.Code: Select all
Define Folder_ID, SFolderLoc.s If SHGetSpecialFolderLocation_(0, #CSIDL_PROFILE, @Folder_ID) = 0 SFolderLoc.s = Space(#MAX_PATH*2) SHGetPathFromIDList_(Folder_ID, @SFolderLoc) CoTaskMemFree_(Folder_ID) EndIf Debug sFolderLoc
Is this an artifact or should it be disposed of ?
-
- New User
- Posts: 5
- Joined: Sun Aug 04, 2024 11:56 pm
Re: SHGetPathFromIDList_ not working
Here is my code. It fails at SHGetPathFromIDList_ becuase MessageRequester("exiting pathrequest","SHGetPathFromIDList") is never hit.
Folder is set in
Global Folder.s
Folder is set in
Global Folder.s
Code: Select all
#BIF_RETURNONLYFSDIRS = 1;
#BIF_DONTGOBELOWDOMAIN = 2;
#BIF_STATUSTEXT = 4;
#BIF_RETURNFSANCESTORS = 8;
#BIF_EDITBOX = 16;
;#BIF_VALIDATE = 32;
#BIF_NEWDIALOGSTYLE = 64;
#BIF_BROWSEINCLUDEURLS = 128;
;;#BIF_USENEWUI = #BIF_EDITBOX | #BIF_NEWDIALOGSTYLE
#BIF_BROWSEFORCOMPUTER = $1000;
#BIF_BROWSEFORPRINTER = $2000;
#BIF_BROWSEINCLUDEFILES = $4000;
#BIF_SHAREABLE = $8000;
#BFFM_INITIALIZED = 1;
#BFFM_SELCHANGED = 2;
#BFFM_VALIDATEFAILEDA = 3;
#BFFM_VALIDATEFAILEDW = 4;
#BFFM_SETSTATUSTEXTA = #WM_USER + 100;
#BFFM_ENABLEOK = #WM_USER + 101;
#BFFM_SETSELECTIONA = #WM_USER + 102;
#BFFM_SETSELECTIONW = #WM_USER + 103;
#BFFM_SETSTATUSTEXTW = #WM_USER + 104;
#BFFM_SETOKTEXT = #WM_USER + 105;
#BFFM_SETEXPANDED = #WM_USER + 106
Global STYLE
#BIF_BROWSEFILEJUNCTIONS = $00010000
CompilerIf #PB_Compiler_Unicode
STYLE = #BFFM_SETSELECTIONW
CompilerElse
STYLE = #BFFM_SETSELECTIONA
CompilerEndIf
Procedure PathRequesterCallback(hWnd, msg, lParam, lData)
Select msg
Case #BFFM_INITIALIZED
;SetWindowPos_(hWnd, #HWND_TOPMOST , -1,-1,-1,-1, #SWP_NOSIZE | #SWP_NOMOVE)
If lData
SendMessage_ (hWnd, STYLE, 1, lData)
Delay(100)
PostMessage_ (hWnd, STYLE, 1, lData)
EndIf
EndSelect
EndProcedure
Procedure.s PathRequesterAPI( Title.s, InitialPath.s)
Folder = Space(#MAX_PATH)
Protected bi.BROWSEINFO
;bi\ulFlags = #BIF_EDITBOX |#BIF_NEWDIALOGSTYLE
bi\ulFlags = #BIF_RETURNONLYFSDIRS |#BIF_DONTGOBELOWDOMAIN | #BIF_RETURNFSANCESTORS | #BIF_STATUSTEXT
bi\lpfn = @PathRequesterCallback()
bi\lParam = @InitialPath
bi\lpszTitle = @Title
Protected Result.L=SHBrowseForFolder_(@bi)
;MessageRequester("exiting pathrequest","SHBrowseForFolder")
SHGetPathFromIDList_(Result, @Folder)
MessageRequester("exiting pathrequest","SHGetPathFromIDList")
CoTaskMemFree_(Result)
ProcedureReturn Folder
EndProcedure
-
- New User
- Posts: 5
- Joined: Sun Aug 04, 2024 11:56 pm
Re: SHGetPathFromIDList_ not working
OK I'll try this. Thanksfirace wrote: Mon Aug 05, 2024 7:40 amCan you try this code (by normeus)? Works fine for me:alphadennis wrote: Mon Aug 05, 2024 12:04 am SHGetPathFromIDList_(Result, @Folder) does not work in the current PureBasic 6.11 LTS (Windows - x64).
It does not give me an error and just terminates the run and puts me back to the windows screen
It worked in my compiled EXE on 5/282023.
What is the new purebasic function?
Windows has SHGetPathFromIDListA and SHGetPathFromIDListW and has discontinued SHGetPathFromIDList_
Note: I'm still running 6.03.Code: Select all
Define Folder_ID, SFolderLoc.s If SHGetSpecialFolderLocation_(0, #CSIDL_PROFILE, @Folder_ID) = 0 SFolderLoc.s = Space(#MAX_PATH*2) SHGetPathFromIDList_(Folder_ID, @SFolderLoc) CoTaskMemFree_(Folder_ID) EndIf Debug sFolderLoc
Re: SHGetPathFromIDList_ not working
Code: Select all
Protected Result.L=SHBrowseForFolder_(@bi)
{Home}.:|:.{Dialog Design0R}.:|:.{Codes}.:|:.{History Viewer Online}.:|:.{Send a Beer}
-
- New User
- Posts: 5
- Joined: Sun Aug 04, 2024 11:56 pm
Re: SHGetPathFromIDList_ not working
Many thanks! Result.i worked in 6.11 LTS (Windows - x64)
Don't know why Result.L workeked in 2023 versions and not this version?
Don't know why Result.L workeked in 2023 versions and not this version?
-
- New User
- Posts: 5
- Joined: Sun Aug 04, 2024 11:56 pm
Re: SHGetPathFromIDList_ not working
Thanks, Result.i worked in 6.11 LTS (Windows - x64)Fred wrote: Mon Aug 05, 2024 8:47 am First thing to check is if you are still using '.l' for variable which handle pointers (should be '.i' or no suffix)
Don't lnow why Result/L worked ok in earlier versions.
Re: SHGetPathFromIDList_ not working
It's because 6.10+ enabled the high entropy flag for allocated memory for 64-bit executable on Windows to avoid memory based attacks. The result of this is the memory pointer can now be very random with value much bigger than 32-bit and it doesn't fit in a .l anymore.