RE: Common Dialogs

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

Cassidy,

The directory selection is actually a shell function, not a common 
dialog (I made the same assumption!).  Here's a partially working 
program to show how to make this happen.  There is a problem with it, 
however.  The memory for the calls to these routines should be allocated 
with shell functions, not typical memory routines (I think this is 
right, I seem to remember reading this in the SDK docs).  I was going to 
finish this to get it working but never got there.  Maybe someone else 
has done this?

HTH,

Jonas

------------------------------------------------
include win32lib.ew
with trace

atom binfo, result,memfolder
sequence folder

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

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


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

binfo = acquire_mem(0, SIZEOF_BROWSEINFO)

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

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

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

Cassidy Napoli wrote:
> How would I get the win32 common dialog for directory selection?  It 
> appears as a treeview of directories that a user can choose from, and 
> returns the directory selected.

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

Search



Quick Links

User menu

Not signed in.

Misc Menu