469,295 Members | 1,928 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,295 developers. It's quick & easy.

Default folder when using SHBrowseForFolder in VB6

8,435 Expert 8TB
I've been researching how to add a "browse for a folder" option to a VB6 program. Found info on using SHBrowseForFolder function, and it works just fine, as far as it goes.

In searching further to find how to provide a default folder, the best I've managed to find was a 4-year-old post in the .Net Framework area pointing to a no-longer-extant blog entry. I eventually traced the old link to here, where it describes how to use a callback function for this purpose. However, I believe the code provided is C++, or some .net language.

Could someone help me out with a VB6 interpretation? If I recall correctly, callback functions were a problem in (even) earlier versions of VB, but 6 should be able to handle them. I'm a bit reluctant to play around with callbacks, though I might give it a bit of a go.

Alternatively, does anyone know another way in VB6 to provide the ability to browse and select a folder rather than a file? For instance, can the common file-selection dialogue be told to select a folder rather than a file? If so, I haven't managed to find that yet.
Dec 18 '11 #1

✓ answered by BigPapaN0z

Unfortunately, we don't have a direct way of selecting a folder short of SHBrowseForFolder. Instead of trying to explain how to do this, I would redirect you to an incredible VB6/VB.Net site vbAccelerator.com. (The link goes directly to the SHBrowseForFolder article) Just about anything that can be done via API can be found there with articles and example code/classes.

Really hope this helps!

3 4374
Unfortunately, we don't have a direct way of selecting a folder short of SHBrowseForFolder. Instead of trying to explain how to do this, I would redirect you to an incredible VB6/VB.Net site vbAccelerator.com. (The link goes directly to the SHBrowseForFolder article) Just about anything that can be done via API can be found there with articles and example code/classes.

Really hope this helps!
Dec 20 '11 #2
Killer42
8,435 Expert 8TB
Thanks for that.

As it turns out, I probably won't make use of their class in the particular project I have in mind, because it needs to be runnable on various PCs without having to register stuff first. But for other situations it could be very handy. And I look forward to a lot of fun browsing the site. :-)

In the end, looking at theirs made me realise how simple it was. So for this project I just built my own simple folder-browse form. There's very little to it; a drive list box, directory list box, a couple of buttons and a few lines of code to tie them together. In fact it's probably much the same as the vbAccelerator one, just not in a class. Oh, and I didn't bother with a create-new-folder button.
Dec 20 '11 #3
Understandable. :) Most of his work utilizes his timer dll, but the source is available for it as well. You could actually use the source version of all of his controls and then you wouldn't have to register anything, as it would be all self contained. Either way, I'm glad it was of use to you. I've drawn much inspiration from that site over the years!
Dec 21 '11 #4

Post your reply

Sign in to post your reply or Sign up for a free account.

Similar topics

reply views Thread by Randal Greene | last post: by
1 post views Thread by Sarah Smith via AccessMonster.com | last post: by
3 posts views Thread by =?Utf-8?B?TGllbGE=?= | last post: by
1 post views Thread by CARIGAR | last post: by
reply views Thread by harlem98 | last post: by
1 post views Thread by Geralt96 | last post: by
reply views Thread by harlem98 | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.