home *** CD-ROM | disk | FTP | other *** search
- VERSION 5.00
- Begin VB.Form Form1
- Appearance = 0 'Flat
- BackColor = &H00C0C0C0&
- BorderStyle = 1 'Fixed Single
- Caption = "Example of how to use SHBrowse.dll"
- ClientHeight = 876
- ClientLeft = 1080
- ClientTop = 1476
- ClientWidth = 5664
- BeginProperty Font
- Name = "MS Sans Serif"
- Size = 7.8
- Charset = 0
- Weight = 700
- Underline = 0 'False
- Italic = 0 'False
- Strikethrough = 0 'False
- EndProperty
- ForeColor = &H80000008&
- LinkTopic = "Form1"
- MaxButton = 0 'False
- MinButton = 0 'False
- PaletteMode = 1 'UseZOrder
- ScaleHeight = 876
- ScaleWidth = 5664
- StartUpPosition = 2 'CenterScreen
- Begin VB.CommandButton Command3
- Appearance = 0 'Flat
- BackColor = &H80000005&
- Caption = "Browse"
- Default = -1 'True
- BeginProperty Font
- Name = "MS Sans Serif"
- Size = 7.8
- Charset = 0
- Weight = 400
- Underline = 0 'False
- Italic = 0 'False
- Strikethrough = 0 'False
- EndProperty
- Height = 360
- Left = 4284
- TabIndex = 0
- Top = 252
- Width = 1215
- End
- Begin VB.Label Label1
- BeginProperty Font
- Name = "MS Sans Serif"
- Size = 7.8
- Charset = 0
- Weight = 400
- Underline = 0 'False
- Italic = 0 'False
- Strikethrough = 0 'False
- EndProperty
- Height = 336
- Left = 168
- TabIndex = 1
- Top = 264
- Width = 3996
- End
- Attribute VB_Name = "Form1"
- Attribute VB_GlobalNameSpace = False
- Attribute VB_Creatable = False
- Attribute VB_PredeclaredId = True
- Attribute VB_Exposed = False
- Option Explicit
- '----------------------------------------------------------
- ' GetFolder
- '-----------
- ' hWnd The window handle of the calling window
- ' DlgCaption The caption of the label that appears just above the Tree control
- ' SelectedPath The String variable that will return the selected path - if any.
- ' (The string space must be allocated by the calling program)
- Private Declare Function GetFolder Lib "SHBrowse.dll" (ByVal hwnd As Long, ByVal DlgCaption As String, ByVal SelectedPath As String) As Long
- Private Sub Command2_Click()
- End
- End Sub
- Private Sub Command3_Click()
- Dim lRet As Long
- Dim DlgCaption As String
- Dim S2 As String
- Dim iPos As Integer
- ' Use a fixed length string
- Dim S As String * 256
- ' Allocate space for the string now. The DLL expects the
- ' memory to have already been allocated for the string
- ' that will return the path selected on the Browse Dlg.
- S = String(256, 0)
- ' Set the caption that will appear just above the Tree.
- DlgCaption = "Select New Folder"
- ' Get the new folder
- lRet = GetFolder(Me.hwnd, DlgCaption, S)
- iPos = InStr(1, S, Chr(0))
- S2 = Left$(S, iPos - 1)
- 'MsgBox "Return path is " & S2
- Label1.Caption = S2
- End Sub
- Private Sub Form_Load()
- ChDrive App.Path
- ChDir App.Path
- End Sub
-