VB6 Open Folder

benamaster

[H]ard|Gawd
Joined
Aug 16, 2005
Messages
1,146
I am wondering how in Visual Basic 6 can I have a command button that on click will open up a folder that is on the CD along with the VB6 program? I'm making an autorun menu.
 
You could use the built-in open file dialog and point it to your folder.

There's also a 'select folder' dialog box too.

Or you could have it execute windows explorer to that specific folder.
 
Vette5885 said:
Or you could have it execute windows explorer to that specific folder.

Would I have to do that with a batch file?

I am used to working in VB.NET and doing database programs.
 
benamaster said:
I am used to working in VB.NET and doing database programs.
Yeah, me too - using VB .NET 2.0 w/ VS05

I'm still in college, so I'm excellent with theory - practice is another story.
 
Visual Studio 2005 is such a better environment than Visual Studio 6. I used to dislike .NET until I started using C# and ASP.NET. The .NET 2.0 platform is great. Now only if it would be good for Autorun CD's where you wouldn't need .NET 2.0 installed. I think I am going to use a Flash .EXE which doesn't need the flash player and I can use actionscript.

I'm a student too and I know all my professor taught for C++ was theory with little application of it outside of homework.
 
Place the following line in a module. Or, alternatively, replace the Public Declare with Private Declare and put it in the Generals section of your form.

Public Declare Function ShellExecute Lib "shell32.dll" Alias "ShellExecuteA" (ByVal hwnd As Long, ByVal lpOperation As String, ByVal lpFile As String, ByVal lpParameters As String, ByVal lpDirectory As String, ByVal nShowCmd As Long) As Long


Place the next code somewhere in your form or module. Call OpenMyFolder with the path of your CD-ROM drive ("D:\") ? Should open a windows explorer window onto your CD.

Sub OpenMyFolder(ByVal sPath As String)
ShellExecute 0&, "open", sPath, "", sPath, 1&
End Sub


Vb6 lives for3v3r :D
 
Back
Top