注册 登录
编程论坛 VB6论坛

用户type错误!!求指导

来风 发布于 2013-02-18 13:45, 338 次点击
程序代码:
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
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


上述代码执行时出现:
compile error:
connot define a public user-define type within a private object module
这是为什么啊 ?求解,,,,在此谢过
3 回复
#2
lowxiong2013-02-18 14:05
自定义类型应该在模块里,不能在窗体里。
翻译的大概意思是:不能在私有模块里定义公用的自定义类型
#3
风吹过b2013-02-18 14:56
自定义 类型 定义时,如果需要在 窗体里定义,那就必须 申明 为私有的

在窗体中省略 公有或私有 申明 时,默认为 公有。
#4
yz10252013-02-18 15:11
程序代码:

Private Declare Function SHGetPathFromIDList Lib "shell32.dll" Alias "SHGetPathFromIDListA" (ByVal pidl As Long, ByVal pszPath As String) As Long
Private Declare Function SHBrowseForFolder Lib "shell32.dll" Alias "SHBrowseForFolderA" (lpBrowseInfo As BrowSEINFO) As Long
Private 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
1