Link to home
Start Free TrialLog in
Avatar of paulmcneil
paulmcneilFlag for United States of America

asked on

Using API GetOpenFile varDirectory parameter

How do pass the varDirectory parameter to the API GetOpenFile function so that the default directory is My computer? Thanks
Avatar of DatabaseMX (Joe Anderson - Former Microsoft Access MVP)
DatabaseMX (Joe Anderson - Former Microsoft Access MVP)
Flag of United States of America image

Well .... this is the Target for a shortcut I have on the destop to open to My Computer:


%SystemRoot%\explorer.exe /e,::{20D04FE0-3AEA-1069-A2D8-08002B30309D}

If that helps ?

mx
that might not be possible...
this is close to that

    strStartDir = Environ("userProfile") & "\desktop"
This my help:

http://www.mvps.org/access/api/api0002.htm

Note the comment:

Stephen Lebans has added functionality to open the browse folder at a specific place.

which leads to:

http://www.lebans.com/callbackbrowser.htm

mx
Apparently the Lebans code will work - I just tried it - see image:
And his MDB is attached

mx
Capture1.gif
A2KCallBackBrowseVer4.zip
yeah, it does but it is not to get a file, will only allow you to select a folder...
ASKER CERTIFIED SOLUTION
Avatar of DatabaseMX (Joe Anderson - Former Microsoft Access MVP)
DatabaseMX (Joe Anderson - Former Microsoft Access MVP)
Flag of United States of America image

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
So, now you have both ... File Browse opening to a specific Folder (my computer) and Folder Browse.

mx
Avatar of paulmcneil

ASKER

Thanks to you both. However, I'm using Vista Ultimate and the code works without error, but still does not open the dialog at My Computer. Do you think the parameter
"::{20D04FE0-3AEA-1069-A2D8-08002B30309D}"
needs adjusting for Vista Ultimate?
Well, I suppose so.  Would have been good to mention that up front.

According to this ... it's the same:

http://www.zdnet.com/blog/bott/the-ultimate-god-mode-list-39-secret-windows-7-shortcuts/1615?pg=3

mx

Then again, I'm not sure what that would change.

Here is more info on those Class IDs ... scroll down to "Before we go on, you need to understand what CLSID values are. These folders, like the Control Panel ..."

http://www.mastiland.com/forums/showthread.php?t=3331&mode=linear

You might nose around the Vista Registry and compare notes.  

mx
Are you absolutely positive it's not working in Vista ?
What folder does it open to ?

mx
OK ... I just tried this in Windows 7 x64 ... and it in fact does open to 'Computer' ... which is the equivalent of My Computer in XP.  So, that tells me it did not change from XP to Vista.

Something else is going on with your system ...

mx
DatabaseMx,
It worked on the Windows XP pc where I'm developing, so you get the points! Thanks for the quick replies everybody.
Problem solved