Тема: SHBrowseForFolder ??? Compile error: cannot define a Public user-definition type whisin an object modul

Вот код открытия функциями API стандартного диалога с директориями.
Public Type BROWSEINFO
На этой строке вылезает ошибка. Почуму?????????????
Declare Function SHGetPathFromIDList Lib "shell32.dll" _
Alias "SHGetPathFromIDListA" (ByVal pidl As Long, ByVal pszPath As String) As Long
Declare Function SHBrowseForFolder Lib "shell32.dll" _
Alias "SHBrowseForFolderA" (lpBrowseInfo As BROWSEINFO) As Long
Public Type BROWSEINFO
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
Function GetDirectory(Optional msg) As String
Dim bInfo As BROWSEINFO
Dim path As String
Dim R As Long, x As Long, pos As Integer
' Root folder = Desktop
bInfo.pidlRoot = 0&
' Title in the dialog
If IsMissing(msg) Then
bInfo.lpszTitle = "Select a folder."
Else
bInfo.lpszTitle = msg
End If
' Type of directory to return
bInfo.ulFlags = &H1
' Display the dialog
x = SHBrowseForFolder(bInfo)
' Parse the result
path = Space$(512)
R = SHGetPathFromIDList(ByVal x, ByVal path)
If R Then
pos = InStr(path, Chr$(0))
GetDirectory = Left(path, pos - 1)
Else
GetDirectory = ""
End If
End Function
'Непосредственно вызов по щелчку некой кнопки:
Private Sub CommandButton1_Click()
Katalog = GetDirectory("Выбор дирректории для CatsTail")
If Katalog <> "" Then MsgBox "Выбрана директория: " & Katalog Else MsgBox "Директория не выбрана!"
End Sub

Re: SHBrowseForFolder ??? Compile error: cannot define a Public user-definition type whisin an object modul

[b]Public Type BROWSEINFO[/b]
На этой строке вылезает ошибка. Почуму?????????????
Declare Function SHGetPathFromIDList Lib "shell32.dll" _
Alias "SHGetPathFromIDListA" (ByVal pidl As Long, ByVal pszPath As String) As Long
Declare Function SHBrowseForFolder Lib "shell32.dll" _
Alias "SHBrowseForFolderA" (lpBrowseInfo As BROWSEINFO) As Long
[b]Public Type BROWSEINFO
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
[/b]

Re: SHBrowseForFolder ??? Compile error: cannot define a Public user-definition type whisin an object modul

и чего

Re: SHBrowseForFolder ??? Compile error: cannot define a Public user-definition type whisin an object modul

деkларации и новые типы данных должны находится в модуле а не в форме

Re: SHBrowseForFolder ??? Compile error: cannot define a Public user-definition type whisin an object modul

> sf
Ну и ничего. Сами то поняли, что написали? В справку смотреть не пробовали? Главное глаза раскрыть и включить мозги.