John W. Colby
jwcolby at colbyconsulting.com
Wed Feb 9 13:39:49 CST 2005
And are we sharing our code? ;-)
John W. Colby
www.ColbyConsulting.com
Contribute your unused CPU cycles to a good cause:
http://folding.stanford.edu/
-----Original Message-----
From: accessd-bounces at databaseadvisors.com
[mailto:accessd-bounces at databaseadvisors.com] On Behalf Of Charlotte Foust
Sent: Wednesday, February 09, 2005 2:29 PM
To: Access Developers discussion and problem solving
Subject: RE: [AccessD] Selecting a directory
No, you can still use the API calls, which is what I've always used instead
of the control.
Charlotte Foust
-----Original Message-----
From: Mike & Doris Manning [mailto:mikedorism at adelphia.net]
Sent: Wednesday, February 09, 2005 10:14 AM
To: 'Access Developers discussion and problem solving'
Subject: RE: [AccessD] Selecting a directory
But please note that you cannot use FileDialog in an Access runtime
application. In that situation you are stuck with CommonDialog control.
Doris Manning
Database Administrator
Hargrove Inc.
www.hargroveinc.com
-----Original Message-----
From: accessd-bounces at databaseadvisors.com
[mailto:accessd-bounces at databaseadvisors.com] On Behalf Of A.D.Tejpal
Sent: Wednesday, February 09, 2005 12:58 PM
To: Access Developers discussion and problem solving
Subject: Re: [AccessD] Selecting a directory
Selecting Folders
---------------------
For Access XP onwards, FileDialog object is very convenient. For earlier
versions, API calls need to be used.
Both methods are demonstrated in my sample db named BackUpManager,
available at Rogers Access Library (other developers library). Link -
http://www.rogersaccesslibrary.com
A.D.Tejpal
--------------
----- Original Message -----
From: Hale, Jim
To: 'Access Developers discussion and problem solving'
Sent: Wednesday, February 09, 2005 20:37
Subject: RE: [AccessD] Selecting a directory
I can't get it to compile. It doesn't like SHGetPathFromIDList. Am I
missing a reference? TIA
Jim Hale
-----Original Message-----
From: Stuart McLachlan [mailto:stuart at lexacorp.com.pg]
Sent: Tuesday, February 08, 2005 10:21 PM
To: Access Developers discussion and problem solving
Subject: Re: [AccessD] Selecting a directory
On 8 Feb 2005 at 22:36, John W. Colby wrote:
> I have used the ADH FindFile module and function for ages. However I
also
> need to select a directory (to copy a file to for example) and the ADH
code
> only allows selecting a file, not a dir. Is there any way to cause that
> code to select a directory? Is there another module / function to use
the
> fileFind dialog to select a directory?
>
Here's the necessary bits to use the SHBrowseForFolder API call:
Public Declare Function SHBrowseForFolder Lib "shell32.dll" _
Alias "SHBrowseForFolderA" (lpBrowseInfo As BROWSEINFO) As Long
Public Type BROWSEINFO 'BI
hOwner As Long
pidlRoot As Long
pszDisplayName As String
lpszTitle As String
ulFlags As Long
lpfn As Long
lParam As Long
iImage As Long
End Type
'BROWSEINFO.ulFlags values:
Public Const BIF_RETURNONLYFSDIRS = &H1 'Only file system
directories
Public Const BIF_DONTGOBELOWDOMAIN = &H2 'No network folders below
domain level
Public Const BIF_STATUSTEXT = &H4 'Includes status area in
the
dialog (for callback)
Public Const BIF_RETURNFSANCESTORS = &H8 'Only returns file system
ancestors
Public Const BIF_EDITBOX = &H10 'Allows user to rename
selection
Public Const BIF_VALIDATE = &H20 'Insist on valid editbox
result (or CANCEL)
Public Const BIF_BROWSEFORCOMPUTER = &H1000 'Only returns computers.
Public Const BIF_BROWSEFORPRINTER = &H2000 'Only returns printers.
Public Const BIF_BROWSEINCLUDEFILES = &H4000 'Browse for everything
Public Const MAX_PATH = 260
Private Sub btnBrowseForFolder_Click()
Dim pidl As Long
Dim BI As BROWSEINFO
Dim sPath As String
Dim pos As Integer
'Fill BROWSEINFO structure data
With BI
.hOwner = 0
.pidlRoot = 0
.lpszTitle = "Browsing"
.ulFlags = 1
.pszDisplayName = Space$(260)
End With
'show dialog returning pidl to selected item
pidl = SHBrowseForFolder(BI)
'if pidl is valid, parse & return the user's selection
sPath = Space$(260)
If SHGetPathFromIDList(ByVal pidl, ByVal sPath) Then
'SHGetPathFromIDList returns the absolute
'path to the selected item. No path is returned for virtual folders.
pos = InStr(sPath, Chr$(0))
If pos Then Text1 = Left(sPath, pos - 1)
Else:
Text1 = "Problem"
End If
'free the pidl
Call CoTaskMemFree(pidl)
End Sub
--
Stuart
--
AccessD mailing list
AccessD at databaseadvisors.com
http://databaseadvisors.com/mailman/listinfo/accessd
Website: http://www.databaseadvisors.com
--
AccessD mailing list
AccessD at databaseadvisors.com
http://databaseadvisors.com/mailman/listinfo/accessd
Website: http://www.databaseadvisors.com
--
AccessD mailing list
AccessD at databaseadvisors.com
http://databaseadvisors.com/mailman/listinfo/accessd
Website: http://www.databaseadvisors.com