Option Explicit
Private Type RECT
Left As Long
Top As Long
Right As Long
Bottom As Long
End Type
Declare Function GetWindowRect Lib "user32" (ByVal hwnd As Long, lpRect As RECT) As Long编译错误: 在私有对象模块中不能定义Public的用户类型.
将type 前加 private,则错成 Private Enum以及用户定义类型不能作为参数。
将type 改加 public, 则错成 在私有对象模块中不能定义public的用户定义类型。
请问,如何修改程序?
Private Type RECT
Left As Long
Top As Long
Right As Long
Bottom As Long
End Type
Declare Function GetWindowRect Lib "user32" (ByVal hwnd As Long, lpRect As RECT) As Long编译错误: 在私有对象模块中不能定义Public的用户类型.
将type 前加 private,则错成 Private Enum以及用户定义类型不能作为参数。
将type 改加 public, 则错成 在私有对象模块中不能定义public的用户定义类型。
请问,如何修改程序?
Declare Function GetWindowRect Lib "user32" (ByVal hwnd As Long, lpRect As RECT) As Long前加上Private的话,就没有错误了~
把API声明写到一个模块文件中(.BAS)Public Declare Function GetWindowRect Lib "user32" (ByVal hwnd As Long, lpRect As RECT) As Long