Amoon(阿木)兄,你的帖子不错,可你忘了按钮的位置(^_^)
Private Declare Function SetParent Lib "user32" (ByVal hWndChild As Long, ByVal hWndNewParent As Long) As Long
Private Declare Function GetDesktopWindow Lib "user32" () As Long
Private Declare Function ClientToScreen Lib "user32" (ByVal hwnd As Long, lpPoint As POINTAPI) As Long
Private Type POINTAPI
x As Long
y As Long
End Type
Private Sub Command1_Click()
Dim frmPoint As POINTAPI
Dim cmdPoint As POINTAPI
Dim x1, y1
ClientToScreen Form1.hwnd, frmPoint
cmdPoint.x = Command1.Left
cmdPoint.y = Command1.Top
x1 = Screen.TwipsPerPixelX
y1 = Screen.TwipsPerPixelY