Re: Win32Lib's selectDirectory
- Posted by Mario Steele <eumario at trilake.net> Mar 03, 2005
- 516 views
ZNorQ wrote: > Can anyone pls. explain what the callback and cbData params. is for? > selectDirectory (sequence title, object flags, atom callback, atom cbData) Okay, this is a very easy thing to answer. First off, the callback, is a routine_id() for a function to accept Calls from the Browse For Folder dialog. Quite simply put, the callback should accept 4 parameters. The first parameter is the hWnd of the Dialog Box created for this, the second one is the Message from the SHBrowseForFolder function, which can be one of these messages: BFFM_INITALIZED -- SHBrowseForFolder has been initalized BFFM_SELCHANGED -- The user selection has changed BFFM_VALIDATEFAILEDA -- The Validation of the Path has failed (ANSI Version) BFFM_VALIDATEFAILEDW -- The Validation of the Path has failed (Unicode Version) The third parameter, is the Word Parameter (EG: wParam), which is generally the structure allocated to use with the SHBrowseForFolder, which consists of these members: bfOwner -- Handle to the Window of the owner of the Dialog bfpidlRoot -- Where the SHBrowseForFolder Dialog should start at (NULL is Top) bfDisplayName -- This is the title for your dialog bfFlags -- The flags that the SHBrowseForFolder Dialog should be created with bfFunction -- This is the C Entry-Point in which the Dialog will call when an event has occured bfParam -- This is where the Path information is stored (I belive) bfImage -- This one I'm not sure about. The Flags are these: BIF_RETURNONLYFSDIRS -- Only File System Directories will be returned BIF_DONTGOBELOWDOMAIN -- Look for Networked Computers BIF_STATUSTEXT -- This is used, cause the Dialog has 2 lines of text -- added to it, for information you want to display. -- It becomes Useless if you use BIF_USENEWUI and -- bfDisplayName gets all 3 lines of text BIF_RETURNSANCESTORS -- Not sure abou this one BIF_EDITBOX -- Add's a Edit Box to the Dialog BIF_VALIDATE -- Tells SHBrowseForFolder to validate paths, and only -- return valid paths, or a cancel event. BIF_NEWDIALOGSTYLE -- Uses the new dialog layout with the ability to resize. -- Caller needs to call OleInitalize() before using this API Flag. BIF_USENEWUI -- This is an or_all() bits of BIF_EDITBOX and BIF_NEWDIALOGSTYLE BIF_BROWSEINCLUDEURLS -- This allows URL's to be browsed to, or entered into the Editbox -- of the dialog, requires BIF_USENEWUI BIF_BROWSEFORCOMPUTER -- Browsing for Computers BIF_BROWSEFORPRINTERS -- Browses for Printers BIF_BROWSEINCLUDEFILES -- Browses for Everything available BIF_SHAREABLE -- Shareable resources are displayed, Requires BIF_USENEWUI The fourth Parameter is the Long Parameter (EG: lParam), which is the allocated memory, that the SHBrowseForFolder() uses to store information into. cbData is the allocated memory that the SHBrowseForFolder() function uses to communicate special things to your program. The reason for the call_back, is to allow you to Enable the button only when the user selects a proper folder, such as making sure that the user selects the Windows Folder, or similar folder, that has a certian file, you look for with your call_back function, in order to properly do certian stuff, such as patching a file, or installing the files to the proper place. Some of these things I'm iffy on, so when in doubt, consult the MSDN refrence for certian specifics. Mario Steele http://enchantedblade.trilake.net Attaining World Dominiation, one byte at a time...