Re[3]: SHBrowseForFolder

new topic     » topic index » view thread      » older message » newer message

But I get illegal operation if I select My computer.

T> This version works for me even with very deeply nested folders:

T> include win32lib.ew
T> with trace

T> atom binfo, result,memfolder
T> sequence folder

T> constant xSHBrowseForFolder = registerw32Function(shell32,
"SHBrowseForFolder",
T> {C_POINTER}, C_POINTER)

T> constant xSHGetPathFromIDList =
registerw32Function(shell32,"SHGetPathFromIDList",{C_ULONG,C_POINTER},C_ULONG)

T> global constant
T> bfOwner = allot( Long ),
T> bfpidlRoot = allot( Long ),
T> bfDisplayName = allot( Lpsz ),
T> bfTitle = allot( Lpsz ),
T> bfFlags = allot( Long ),
T> bfFunction = allot( Long ),
T> bfParam = allot( Long ),
T> bfImage = allot( Long ),
T> SIZEOF_BROWSEINFO = allotted_size()

T> binfo = acquire_mem(0, SIZEOF_BROWSEINFO)

T> store( binfo, bfOwner, 0)
T> store( binfo, bfpidlRoot, NULL)
T> store( binfo, bfDisplayName, "")
T> store( binfo, bfTitle, "Select a Folder")
T> store( binfo, bfFlags, NULL)
T> store( binfo, bfFunction, NULL)
T> store( binfo, bfParam, NULL)
T> store( binfo, bfImage, NULL)

T> result = w32Func(xSHBrowseForFolder, {binfo})

T> memfolder= acquire_mem(0,repeat(512,0))
T> if w32Func(xSHGetPathFromIDList,{result,memfolder}) then
T>    --the string pointed to by folder now contains the path
T>    folder = peek_string(memfolder)
T> else
T>    folder = ""
T> end if
T> release_mem(memfolder)
T> release_mem(binfo)

T> if message_box("Folder: " & folder, "Test", MB_OK) then end if

T> Thomas Parslow (PatRat) ICQ #:26359483
T> Rat Software
T> http://www.rat-software.com/
T> Please leave quoted text in place when replying

new topic     » topic index » view thread      » older message » newer message

Search



Quick Links

User menu

Not signed in.

Misc Menu