Link to home
Start Free TrialLog in
Avatar of keithchiu
keithchiu

asked on

LotusScript calling API SHBrowseForFolder

In Notes 4.52, I tried using SHBrowseForFolder to select a folder/directory in my harddrive.

It works for returning the target directory.  However, I don't know how to pass the Initial directory, say c:\My Documents, to the SHBrowseForFolder window.

For anyone who can use LotusScript to perform the call back routine to pass a pre-defined directory into the SHBrowseForFolder, please help me to solve it?
Avatar of ghassan99
ghassan99

Check this site for more info:
http://www.mvps.org/vbnet/code/shell/browsefolders.htm

What you want to do is set the starting directory that the user see at first...I dont think you need callback for that.  The pointer "browseinfo.pidlRoot" contains the starting directory, if its 0 or Null it will start at the desktop.

-Gus
Avatar of keithchiu

ASKER

For browseinfo.pidlRoot, any function call so that I can pass a string "C:\My Documents" or other path string and get the folder id (long)?

You can use:
SHGetFolderLocation or SHGetSpecialFolderLocation

An excellent example can be found here:
http://www.mvps.org/btmtz/browsdlg/

more detailed info can be found here:
http://www.vbapi.com/ref/s/shgetfolderlocation.html

This function will fill in the value in a special structure called ITEMIDLIST, then use it like the example - BI.pidlRoot = IDL.mkid.cb
You tell the function of the special folder through predefined CSIDL's, like "C:\My Documents" is 'CSIDL_PERSONAL', which u pass to the SHGetFOlderLocation.

-Gus
Your answer is encouraging.  However, it seems that SHGetFolderLocation or SHGetSpecialFolderLocation can only get special folders and not for folders created manually. (e.g, c:\A\B\C\)

Using pidlroot will only show the specific folder and its subfolders that User cannot click to uppper folder.  In Notes, is there any method for the SHBrowseForFolder to show the root as Desktop and a default highlighted directory is somewhere else (c:\A\B\C\)?
ASKER CERTIFIED SOLUTION
Avatar of ghassan99
ghassan99

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Any news?

-Gus
When I knew that it does not support the callback function, I gave up and the application simply has no default folder.  Anyway, thank you very much.  Your answer saved me a lot of time.