By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
440,057 Members | 1,363 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 440,057 IT Pros & Developers. It's quick & easy.

select folder

P: 21
hi i want to select folder in code so i did some code i.e
Expand|Select|Wrap|Line Numbers
  1. Private Const BIF_RETURNONLYFSIDIRS = 1
  2. Private Const BIF_DONTGOBELOWDOMAIN = 2
  3. Private Const MAX_PATH = 260
  4.  
  5.  
  6. Private Declare Function SHBROWSERFORFOLDER Lib "shell32" (lpbi As BrowsInfo) As Long
  7. Private Declare Function SHGETPATHFROMIDLIST Lib "shell32" (ByVal PIDLIST As Long, ByVal LPBUFFER As String) As Long
  8. Private Declare Function LSTRCAT Lib "Kernel32" Alias "lstrcatA" (ByVal LPSTRING1 As String, ByVal LPSTRING2 As String) As Long
  9.  
  10. Private Type BrowsInfo
  11. hWndOwner As Long
  12. pIDLRoot As Long
  13. pSZDisplayName As Long
  14. lPSZTitle As Long
  15. ulFlags As Long
  16. lpfn_call_back As Long
  17. lparam As Long
  18. iImage As Long
  19. End Type
  20. Private Sub browser()
  21. On Error Resume Next
  22. Dim lpidlist As Long
  23. Dim sbuffer As String
  24. Dim sztitle As String
  25. Dim tbrowseinfo As BrowsInfo
  26.  
  27. sztitle = "Compress and encrypt files(s) in folder"
  28.  
  29. With tbrowseinfo
  30. .hWndOwner = Me.hWnd
  31. .lPSZTitle = LSTRCAT(sztitle, " ")
  32. .ulFlags = BIF_RETURNONLYFSIDIRS + BIF_DONTGOBELOWDOMAIN
  33. End With
  34.  
  35. lpidlist = SHBROWSERFORFOLDER(tbrowseinfo)
  36.  
  37. If (lpidlist) Then
  38.         sbuffer = Space(MAX_PATH)
  39.         SHGETPATHFROMIDLIST lpidlist, sbuffer
  40.         sbuffer = Left(sbuffer, InStr(sbuffer, vbnullclear) - 1)
  41.         txtpath.Text = sbuffer
  42.             If txtpath.Text = " " Then
  43.             Exit Sub
  44.             End If
  45. End If
  46.  
  47.  
  48. End Sub
  49.  
  50.  
  51. Private Sub cmdselect_Click()
  52. On Error GoTo cmdserr
  53. If Text1.Text = "" Then
  54. MsgBox " First code password"
  55. Text1.SetFocus
  56. Exit Sub
  57. End If
  58. Call browser
  59. cmdserr:
  60. kpathname = ""
  61. MsgBox Err.Description
  62.  
  63. End Sub
but why its gives error that

can't find DLL entry point SHBROWSERFORFOLDER in shell32

please tell me
Dec 3 '07 #1
Share this Question
Share on Google+
1 Reply


debasisdas
Expert 5K+
P: 8,127
Please find more about SHBROWSERFORFOLDER.
Dec 6 '07 #2

Post your reply

Sign in to post your reply or Sign up for a free account.