Private Type POINTAPI
X As Long
Y As Long
End Type
Dim p() As POINTAPI
Private Declare Function CreatePolygonRgn Lib "gdi32" (lpPoint As POINTAPI, ByVal nCount As Long, ByVal nPolyFillMode As Long) As Long
Private Declare Function SetWindowRgn Lib "user32" (ByVal hWnd As Long, ByVal hRgn As Long, ByVal bRedraw As Boolean) As Long
Private Sub form_click()
Dim hRgn As Long
Dim lRes As Long
ReDim p(4) As POINTAPI
With Me
p(0).X = 0
p(0).Y = 0
p(1).X = .ScaleWidth
p(1).Y = 0
p(2).X = .ScaleWidth
p(2).Y = .ScaleHeight
p(3).X = 0
p(3).Y = .ScaleHeight
End With
hRgn = CreatePolygonRgn(p(0), 4, 2)
lRes = SetWindowRgn(Me.hWnd, hRgn, True)
End Sub
应该用GetCursorPos
Public Declare Function GetCursorPos Lib "user32" Alias "GetCursorPos" (lpPoint As POINTAPI) As Long
Public Type POINTAPI
x As Long
y As Long
End Type
dim blnReturn as boolean
dim CurPos as POINTAPI
blnReturn=GetCursorPos(CurPos)
if blnReturn then
CurPos.x
CurPos.y
end if