首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > 开发语言 > VB >

大家帮小弟我看看这句话

2012-03-16 
大家帮我看看这句话DimMyRectAsRECTDimMypointAsPOINTAPIGetWindowRectMe.hwnd,MyRectGetCursorPosMypoint

大家帮我看看这句话
Dim   MyRect   As   RECT
Dim   Mypoint   As   POINTAPI
GetWindowRect   Me.hwnd,   MyRect
GetCursorPos   Mypoint
m   =   PtInRect(MyRect,   Mypoint)
VB提示DLL约定错误,百思不得其解呀..
请大家帮帮忙

[解决办法]
检查一下是否定义的类型和API说明的有出入
[解决办法]
编译成exe文件后就没事了。你是在 VB IDE 里发生的吧
[解决办法]
Private Declare Function GetWindowRect Lib "user32 " (ByVal hwnd As Long, lpRect As RECT) As Long
Private Declare Function GetCursorPos Lib "user32 " (lpPoint As POINTAPI) As Long
Private Declare Function PtInRect Lib "user32.dll " (ByRef lpRect As RECT, ByVal x As Long, ByVal y As Long) As Long

Private Type RECT
Left As Long
Top As Long
Right As Long
Bottom As Long
End Type
Private Type POINTAPI
x As Long
y As Long
End Type
Private Sub Command1_Click()
Dim MyRect As RECT
Dim Mypoint As POINTAPI
GetWindowRect Me.hwnd, MyRect
GetCursorPos Mypoint
m = PtInRect(MyRect, Mypoint.x, Mypoint.y)
MsgBox m
End Sub
璇曡瘯杩欎釜

热点排行