| View previous topic :: View next topic |
| Author |
Message |
bobobobbins Expert Cheater
Reputation: 0
Joined: 28 Jun 2007 Posts: 120 Location: someplace
|
Posted: Fri Jan 04, 2008 4:22 am Post subject: Question on VB |
|
|
For visual basic can someone show me how to make a simple program where i put in buttons to go to a directory and open a file i wish to open?
can u do kinda what u do in delphi were u do the shellexecute thing?
|
|
| Back to top |
|
 |
Trow Grandmaster Cheater
Reputation: 2
Joined: 17 Aug 2006 Posts: 957
|
Posted: Fri Jan 04, 2008 7:18 am Post subject: |
|
|
Chuck this into a module.
| Code: |
Public Declare Function SHBrowseForFolder Lib "SHELL32" (lpBI As BrowseInfo) As Long
Public Declare Function SHGetPathFromIDList Lib "SHELL32" (ByVal pidList As Long, ByVal lpBuffer As String) As Long
Public Declare Function lstrcat Lib "kernel32" Alias "lstrcatA" (ByVal lpString1 As String, ByVal lpString2 As String) As Long
Private Type BrowseInfo
hwndOwner As Long
pIDLRoot As Long
pszDisplayName As Long
lpszTitle As Long
ulFlags As Long
lpfnCallback As Long
lParam As Long
iImage As Long
End Type
Public Const BIF_RETURNONLYFSDIRS = 1
Public Const BIF_DONTGOBELOWDOMAIN = 2
Public Const BIF_BROWSEFORCOMPUTER = &H1000
Public Const MAX_PATH = 260
Public Function BrowseForFolder(Owner As Long, Optional szTitle As String = "Select Folder...") As String
Dim lpIDList As Long
Dim sBuffer As String
Dim tBrowseInfo As BrowseInfo
With tBrowseInfo
.hwndOwner = Owner
.lpszTitle = lstrcat(szTitle, "")
.ulFlags = BIF_RETURNONLYFSDIRS + BIF_DONTGOBELOWDOMAIN
End With
lpIDList = SHBrowseForFolder(tBrowseInfo)
If (lpIDList) Then
sBuffer = Space(MAX_PATH)
SHGetPathFromIDList lpIDList, sBuffer
sBuffer = Left(sBuffer, InStr(sBuffer, vbNullChar) - 1)
BrowseForFolder = sBuffer
End If
End Function
|
And this is how you call it...
| Code: | Private Sub Command1_Click()
MsgBox BrowseForFolder(Me.hWnd)
End Sub
|
Sorry, it does have to be that long in vb6. did you say vb6?
_________________
Get kidnapped often. |
|
| Back to top |
|
 |
Lolkittycat Advanced Cheater
Reputation: 0
Joined: 02 Jan 2008 Posts: 50 Location: At a farm
|
Posted: Fri Jan 04, 2008 7:20 am Post subject: |
|
|
What version?
_________________
Stop piracy, dont be a duche  |
|
| Back to top |
|
 |
BEO-WULF Expert Cheater
Reputation: 0
Joined: 27 Jan 2008 Posts: 138 Location: Green Bay, Wisconsin
|
Posted: Sat Feb 02, 2008 1:21 am Post subject: |
|
|
some times the vb's do have to be a certain length and highth for them to work just found that out like 10 minutes ago lol
_________________
4 L1F3 ( + [__] : : ) 4 L1F3 |
|
| Back to top |
|
 |
|