1. Win32Lib's selectDirectory

As the Win32Lib's documentation on selectDirectory is rather poor, I'm trying
my luck on the Forum; 

Can anyone pls. explain what the callback and cbData params. is for?
  selectDirectory (sequence title, object flags, atom callback, atom cbData)

I'd also appreciate if someone could give me some examples of the flags param?

Kenneth / ZNorQ

new topic     » topic index » view message » categorize

2. Re: Win32Lib's selectDirectory

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...

new topic     » goto parent     » topic index » view message » categorize

3. Re: Win32Lib's selectDirectory

Mario Steele wrote:
> 
> 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
> <a
> href="http://enchantedblade.trilake.net">http://enchantedblade.trilake.net</a>
> Attaining World Dominiation, one byte at a time...
> 

Thanks Mario, this is good stuff!
Kenneth/ZNorQ

new topic     » goto parent     » topic index » view message » categorize

4. Re: Win32Lib's selectDirectory

you cant use win32lib with just with win32lib docs, even if they were completed.
you really need MSDN (=win32 API) docs too

when using win32lib, or any other winapi wrapper lib.

new topic     » goto parent     » topic index » view message » categorize

5. Re: Win32Lib's selectDirectory

Tone Škoda wrote:
> 
> 
> you cant use win32lib with just with win32lib docs, even if they were
> completed. you
> really need MSDN (=win32 API) docs too 
> 
> when using win32lib, or any other winapi wrapper lib.
> 

This is very true.  I've used Win32lib alot.  And it becomes very logical,
that when you start wanting more things for your program, that you start
having to refer to the MSDN documentation, to see how things work.  When
the documentation for Win32lib, and other WinAPI libraries are done, they
take into account, that you have experince with Windows Programming, and
leave out certian stuff.  Or leave other stuff out, cause they don't exactly
understand how it works, just that it works.

Mario Steele
http://enchantedblade.trilake.net
Attaining World Dominiation, one byte at a time...

new topic     » goto parent     » topic index » view message » categorize

6. Re: Win32Lib's selectDirectory

Tone Škoda wrote:
> 
> 
> you cant use win32lib with just with win32lib docs, even if they were
> completed. you
> really need MSDN (=win32 API) docs too 
> 
> when using win32lib, or any other winapi wrapper lib.
> 

Yes I agree. I haven't been around in MSDN too much, but I'm getting around
familiarizing myself with the content. But, as I'm not the most experienced
WinAPI programmer, I had abit hard time finding the info I was looking for.
But, I'm getting there! :D

Thx Tone.

new topic     » goto parent     » topic index » view message » categorize

Search



Quick Links

User menu

Not signed in.

Misc Menu