|
-
Sep 2nd, 2006, 01:42 AM
#1
Thread Starter
Hyperactive Member
Browsing Button????
hi,
i want to make a button which functionality will be as typical browsing button. plzz guide me regarding that.
regards,
fims
-
Sep 2nd, 2006, 03:30 AM
#2
Re: Browsing Button????
Try this
VB Code:
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
Const BIF_RETURNONLYFSDIRS = 1
Const MAX_PATH = 260
Private Declare Sub CoTaskMemFree Lib "ole32.dll" (ByVal hMem As Long)
Private Declare Function lstrcat Lib "kernel32" Alias "lstrcatA" (ByVal lpString1 As String, ByVal lpString2 As String) As Long
Private Declare Function SHBrowseForFolder Lib "shell32" (lpbi As BrowseInfo) As Long
Private Declare Function SHGetPathFromIDList Lib "shell32" (ByVal pidList As Long, ByVal lpBuffer As String) As Long
Private Sub Form_Load()
'KPD-Team 1998
'URL: [url]http://www.allapi.net/[/url]
Dim iNull As Integer, lpIDList As Long, lResult As Long
Dim sPath As String, udtBI As BrowseInfo
With udtBI
'Set the owner window
.hWndOwner = Me.hWnd
'lstrcat appends the two strings and returns the memory address
.lpszTitle = lstrcat("C:\", "")
'Return only if the user selected a directory
.ulFlags = BIF_RETURNONLYFSDIRS
End With
'Show the 'Browse for folder' dialog
lpIDList = SHBrowseForFolder(udtBI)
If lpIDList Then
sPath = String$(MAX_PATH, 0)
'Get the path from the IDList
SHGetPathFromIDList lpIDList, sPath
'free the block of memory
CoTaskMemFree lpIDList
iNull = InStr(sPath, vbNullChar)
If iNull Then
sPath = Left$(sPath, iNull - 1)
End If
End If
MsgBox sPath
End Sub
-
Sep 2nd, 2006, 03:31 AM
#3
Re: Browsing Button????
This will open the Browse Dialog Box when the form is loaded.And If you select Any file it will display the filename in the msgbox otherwise it will display a blank msgbox.
-
Sep 2nd, 2006, 03:45 AM
#4
Thread Starter
Hyperactive Member
Re: Browsing Button????
can u please tell me wht its mean?
-
Sep 2nd, 2006, 03:52 AM
#5
Re: Browsing Button????
It is a Browers Type Declartion
-
Sep 2nd, 2006, 04:10 AM
#6
Thread Starter
Hyperactive Member
Re: Browsing Button????
whts this property of form do?
-
Sep 2nd, 2006, 04:25 AM
#7
Re: Browsing Button????
It will get the Handle(Long Integer) of the Form that you are Using.
-
Sep 2nd, 2006, 08:22 AM
#8
Thread Starter
Hyperactive Member
Re: Browsing Button????
Can u plz guide me abt these lines?
VB Code:
Private Declare Sub CoTaskMemFree Lib "ole32.dll" (ByVal hMem As Long)
Private Declare Function lstrcat Lib "kernel32" Alias "lstrcatA" (ByVal lpString1 As String, ByVal lpString2 As String) As Long
Private Declare Function SHBrowseForFolder Lib "shell32" (lpbi As BrowseInfo) As Long
Private Declare Function SHGetPathFromIDList Lib "shell32" (ByVal pidList As Long, ByVal lpBuffer As String) As Long
-
Sep 2nd, 2006, 08:36 AM
#9
Re: Browsing Button????
This are *declarations* (refferers) to some functions (APIs) that are already declared in some libraries somewhere in the system (in that case ole32.dll, kernel32.dll and shell32.dll). To learn more about APIs i suggest you to take a look at AllAPI.net.
-
Sep 2nd, 2006, 09:34 AM
#10
Thread Starter
Hyperactive Member
Re: Browsing Button????
Can u tell me please that is 'lpIDList' variable tells whether the list can be displayed or not? n how it works?
thankx for the guidance
-
Sep 13th, 2006, 11:47 AM
#11
Thread Starter
Hyperactive Member
Re: Browsing Button????
this code does not select file... access only hierarchy of folders plzzz tell me how can i access file in that specified folder?????????????
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|