![]() |
#2
Artless2012-10-30 12:53
|
移动表单包含内置控件~透过一支外挂程序去做上下左右移动~

Option Explicit
Dim fhwnd As Long
'left top Width Height
Private Sub CmdDown_Click()
Dim rtn As Long, MoveW As Long, x1 As Long, y1 As Long
rtn = GetWindowRect(fhwnd, Rectan)
x1 = Rectan.Bottom + 10
MoveW = MoveWindow(fhwnd, x1, y1, Rectan.Right, Rectan.Top, True)
End Sub
Private Sub CmdLeft_Click()
Dim rtn As Long, MoveW As Long
rtn = GetWindowRect(fhwnd, Rectan)
' MoveW = MoveWindow(fhwnd, x1, y1, wid, het, True)
End Sub
Private Sub CmdRight_Click()
Dim rtn As Long, MoveW As Long
rtn = GetWindowRect(fhwnd, Rectan)
' MoveW = MoveWindow(fhwnd, x1, y1, wid, het, True)
End Sub
Private Sub CmdUp_Click()
Dim rtn As Long, MoveW As Long
rtn = GetWindowRect(fhwnd, Rectan)
' MoveW = MoveWindow(fhwnd, x1, y1, wid, het, True)
End Sub
Private Sub Command5_MouseDown(Button As Integer, Shift As Integer, x As Single, y As Single)
Timer1.Enabled = Not Timer1.Enabled
End Sub
Private Sub Command5_MouseUp(Button As Integer, Shift As Integer, x As Single, y As Single)
Timer1.Enabled = Not Timer1.Enabled
End Sub
Private Sub Form_Load()
Me.Height = CmdDown.Top + CmdDown.Height
Me.Width = CmdRight.Left + CmdRight.Width
SetWindowPos Me.hwnd, -1, 0, 0, 0, 0, 3
Call GetFlowHwnd
End Sub
Private Sub Frame1_MouseDown(Button As Integer, Shift As Integer, x As Single, y As Single)
If Button = 2 Then
PopupMenu Menu
End If
End Sub
Private Sub Timer1_Timer()
Dim P As POINT
GetCursorPos P
Me.Left = P.x * 15
Me.Top = P.y * 15
End Sub
Private Sub bye_Click()
Unload Me
End Sub
Private Sub GetFlowHwnd()
fhwnd = FindWindow("ThunderRT6FormDC", "Project Flow")
End Sub