I am afraid this note is not by your friendly expert Alyce Watson, but by ignoramus Petermat. Why? Because Alyce did not write this, I needed it, and all I can do is to try to find my way. If I fail maybe someone will be encouraged to pick up and correct the note. Why is the note necessary? Because Microsoft documents it's API's using C / C++ examples
<span style="font-size: 1.1em;">BIF.RETURNONLYFSDIRS = 1
MAX.PATH = 260
STRUCT BrowseInfo,_
hWndOwner As uLong,_
pIDLRoot As Long,_
pszDisplayName As Long,_
lpszTitle$ As ptr,_
ulFlags As Long,_
lpfnCallback As Long,_
lParam As Long,_
iImage As Long
'Set the owner window, optional
BrowseInfo.hWndOwner.struct = 0
BrowseInfo.lpszTitle$.struct = text$
'Return only if the user selected a directory
BrowseInfo.ulFlags.struct = BIF.RETURNONLYFSDIRS
'Show the 'Browse for folder dialog
calldll #shell32, "SHBrowseForFolder",_
BrowseInfo as struct,_
lpIDList as long
If lpIDList>0 Then
sPath$ = space$(MAX.PATH) + chr$(0)
'Get the path from the IDList
calldll #shell32, "SHGetPathFromIDList",lpIDList as long,sPath$ as ptr,r as long
open "ole32" for dll as #ole
'Free the block of memory
calldll #ole, "CoTaskMemFree",_
lpIDList as long,_
r as long
close #ole
iNull = InStr(sPath$, chr$(0))
If iNull Then sPath$ = Left$(sPath$, iNull - 1)
End If
print sPath$
</span>
ABCs of APIs 11 - Translating documentation for DLLs in MS "C" into Liberty BASIC
PetermatABCs of APIs 11 - Translating documentation for DLLs in MS "C" into Liberty BASIC | Introduction | Third Part Title
Introduction
I am afraid this note is not by your friendly expert Alyce Watson, but by ignoramus Petermat. Why? Because Alyce did not write this, I needed it, and all I can do is to try to find my way. If I fail maybe someone will be encouraged to pick up and correct the note.Why is the note necessary? Because Microsoft documents it's API's using C / C++ examples
The example I am going to use.
The following LB code is due to "MKnarr" on
http://libertybasic.conforums.com/index.cgi?board=api&num=1175176417&action=display&start=15
If you run this it will open a window showing a folder tree headed by "My computor". If you select a folder then this will be returned in sPath$
<span style="font-size: 1.1em;">BIF.RETURNONLYFSDIRS = 1 MAX.PATH = 260 STRUCT BrowseInfo,_ hWndOwner As uLong,_ pIDLRoot As Long,_ pszDisplayName As Long,_ lpszTitle$ As ptr,_ ulFlags As Long,_ lpfnCallback As Long,_ lParam As Long,_ iImage As Long 'Set the owner window, optional BrowseInfo.hWndOwner.struct = 0 BrowseInfo.lpszTitle$.struct = text$ 'Return only if the user selected a directory BrowseInfo.ulFlags.struct = BIF.RETURNONLYFSDIRS 'Show the 'Browse for folder dialog calldll #shell32, "SHBrowseForFolder",_ BrowseInfo as struct,_ lpIDList as long If lpIDList>0 Then sPath$ = space$(MAX.PATH) + chr$(0) 'Get the path from the IDList calldll #shell32, "SHGetPathFromIDList",lpIDList as long,sPath$ as ptr,r as long open "ole32" for dll as #ole 'Free the block of memory calldll #ole, "CoTaskMemFree",_ lpIDList as long,_ r as long close #ole iNull = InStr(sPath$, chr$(0)) If iNull Then sPath$ = Left$(sPath$, iNull - 1) End If print sPath$ </span>Third Part Title
Text here.'code hereABCs of APIs 11 - Translating documentation for DLLs in MS "C" into Liberty BASIC | Introduction | Third Part Title