473,574 Members | 2,580 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Default folder when using SHBrowseForFold er in VB6

8,435 Recognized Expert Expert
I've been researching how to add a "browse for a folder" option to a VB6 program. Found info on using SHBrowseForFold er 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
3 4646
24 New Member
Unfortunately, we don't have a direct way of selecting a folder short of SHBrowseForFold er. Instead of trying to explain how to do this, I would redirect you to an incredible VB6/VB.Net site vbAccelerator.c om. (The link goes directly to the SHBrowseForFold er 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
8,435 Recognized Expert Expert
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
24 New Member
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

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

Similar topics

by: Jason Heyes | last post by:
Can somebody tell me how to change only the main function below so that bar in the default namespace is assigned 4 and not bar in namespace foo? int bar; namespace foo { int bar; } using namespace foo; int main() { bar = 4;
by: Randal Greene | last post by:
We are using hyperlinks quite extensively in our Access XP application, and would like to control the working directory (default folder) used by the Insert Hyperlink dialog. Thanks in advance for any ideas...
by: Sarah Smith via AccessMonster.com | last post by:
I am using the Command Button Wizard to create a 'Find Record' button on my form. The Wizard sets the defaults to be 'Find Next' for the buttons and 'Whole', 'Entire' and 'Current Record' for the criteria. How can I change these so that everytime I open the form, I don't have to manually reset them? Thanks -- Message posted via...
by: Freddie | last post by:
I have a simple visual basic program that looks thru my outlook inbox. I start the program from a scheduled task, running on a server. It works perfectly when I'm logged in, but when I'm not the program shuts down when it is trying to get the default folder. Is there maybe a security, that I have to be logged in, so the program can access...
by: gavin | last post by:
Want to print to a file in MDI Format. Have set up a Microsoft Office Document Image Writer Printer. How can I change the Default Folder in Printing Preferences in the Advanced Tab Programmatically?
by: aa | last post by:
I have installed IIS on win XP pro However I cannot find a control panel like PWS on w2k to change default folder. How do I do that?
by: mpetter | last post by:
Hi guys ! How Can I Create a contact item(Outlook 2003) in specific folder under default folder? I have this situation: Set myolApp = CreateObject("Outlook.Application") Set myNameSpace = myolApp.GetNamespace("MAPI") Set myFolder = myNameSpace.GetDefaultFolder(olFolderContacts).Folders("Teste") I would like create a contact item under...
by: DKn | last post by:
Hello All, I am having an ACtiveX Control developed in C#.Net 2.0 windows Control Library. I have tested this control.TCS through ACtiveX Control Test Container. It is working fine, But the logs are getting created in the folder where the TSTCON32.exe is located, instead of creating in the aplication folder. When i Run the application in...
by: HugoFromBOSS | last post by:
Hello, All Virtualhosts are routing to my default folder. Any Ideas? Thanks
by: =?Utf-8?B?TGllbGE=?= | last post by:
I have a user who stores her documents on a different drive and when she attempts to open documents it auto defaults to My Documents instead of her other drive. Is there a way to change the default for her?
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language...
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. ...
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that...
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the...
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then...
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes...
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert...
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.