Results 1 to 4 of 4

Thread: HELP! How do you open a folder window from within VB?

  1. #1

    Thread Starter
    Member
    Join Date
    Jun 2000
    Location
    Ontario, CANADA
    Posts
    37

    Question

    You know how you can open MyComputer and double click on C: ... that opens a window to browse drive C. How do you open a window like that from within VB? hmmm-hnnn...

  2. #2
    Member
    Join Date
    Jun 2000
    Location
    Gainesville, Ga
    Posts
    50

    try this

    i = Shell("c:\windows\explorer.exe", 3) ' 3=maximized
    Scott Cato
    VB6s

  3. #3
    Fanatic Member
    Join Date
    Jan 2000
    Location
    Nitro
    Posts
    633
    Hello Catocom!

    I think Daniel_Bigham wants it to open in a specific directory.

    Drop this into a module. There are two different methods. You can use either one.
    Code:
    Private 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
    Private Const SW_SHOWNORMAL = 1
    Private Const SW_SHOWMINIMIZED = 2
    Private Const SW_SHOWMAXIMIZED = 3
    Private Const SW_SHOW = 5
    Private Const SW_MINIMIZE = 6
    Private Const SW_SHOWMINNOACTIVE = 7
    Private Const SW_SHOWNA = 8
    Private Const SW_RESTORE = 9
    Private Const SW_SHOWDEFAULT = 10
    
    Private Sub Main()
    'Method1
      Call ShellExecute(0, "Open", "C:\WhatEver Directory", vbNullString, vbNullString, SW_SHOWNORMAL)
    
    'Method2
      Call ShellExecute(0, "Explore", "C:\WhatEver Directory", vbNullString, vbNullString, SW_SHOWNORMAL)
    End Sub
    [Edited by Nitro on 06-29-2000 at 02:21 PM]
    Chemically Formulated As:
    Dr. Nitro

  4. #4

    Thread Starter
    Member
    Join Date
    Jun 2000
    Location
    Ontario, CANADA
    Posts
    37
    Beauty! Thanks for your help in getting that folder code... I'll give it a whirl on Tuesday.

    My reason for asking was that my program has an "export to HTML" feature, and I wanted to open the folder that it creates the HTML file in for them to use... now I will be home free

    This forum kicks

    Thanks again.

    PS Any suggestions on this idea: What if I want to send "rich text" (Formatted text) to the clipboard so that it can be pasted into, say, an HTML email message? How could one go about THAT?

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width