[blue]Private Const VER_PLATFORM_WIN32_NT = 2
Private Type OSVERSIONINFO
dwOSVersionInfoSize As Long
dwMajorVersion As Long
dwMinorVersion As Long
dwBuildNumber As Long
dwPlatformId As Long
szCSDVersion As String * 128
End Type
Private Declare Function GetVersionEx Lib "kernel32" Alias "GetVersionExA" _
(ByRef lpVersionInformation As OSVERSIONINFO) As Long
Private Declare Function GetFileNameFromBrowseW Lib "shell32" Alias "#63" _
(ByVal hwndOwner As Long, _
ByVal lpstrFile As Long, _
ByVal nMaxFile As Long, _
ByVal lpstrInitialDir As Long, _
ByVal lpstrDefExt As Long, _
ByVal lpstrFilter As Long, _
ByVal lpstrTitle As Long) As Long
Private Declare Function GetFileNameFromBrowseA Lib "shell32" Alias "#63" _
(ByVal hwndOwner As Long, _
ByVal lpstrFile As String, _
ByVal nMaxFile As Long, _
ByVal lpstrInitialDir As String, _
ByVal lpstrDefExt As String, _
ByVal lpstrFilter As String, _
ByVal lpstrTitle As String) As Long
Public Function BrowseFiles()
Dim sSave As String
sSave = Space(255)
'If we're on WinNT, call the unicode version of the function
If IsWinNT Then
GetFileNameFromBrowseW Screen.ActiveForm.hwnd, _
StrPtr(sSave), _
255, _
StrPtr("c:\"), _
StrPtr("txt"), _
StrPtr("Text files (*.txt)" + Chr$(0) + "*.txt" + Chr$(0) + _
"All files (*.*)" + Chr$(0) + "*.*" + Chr$(0)), _
StrPtr("The Title")
'If we're not on WinNT, call the ANSI version of the function
Else
GetFileNameFromBrowseA Screen.ActiveForm.hwnd, _
sSave, _
255, _
"c:\", _
"txt", _
"All files (*.*)" + Chr$(0) + "*.*" + Chr$(0) + _
"Text files (*.txt)" + Chr$(0) + "*.txt" + Chr$(0), _
"The Title"
End If
BrowseFiles = Trim(Replace(sSave, Chr$(0), " "))
End Function
Public Function IsWinNT() As Boolean
Dim myOS As OSVERSIONINFO
myOS.dwOSVersionInfoSize = Len(myOS)
GetVersionEx myOS
IsWinNT = (myOS.dwPlatformId = VER_PLATFORM_WIN32_NT)
End Function[/blue]