Home > Software engineering >  Vb mouse click inside the window a fixed coordinates, how to do
Vb mouse click inside the window a fixed coordinates, how to do

Time:09-24



Excuse me, how the background automatically click the Command1 button? Form to minimize can also click to, and shall not affect the front desk of the mouse!

Not to use the call Command1_Click

Pray god to the code

CodePudding user response:

 Command1_Click ()

CodePudding user response:

Miss zhao, didn't see the code

CodePudding user response:

refer to the second floor qq_35075199 response:
miss zhao, didn't see the code oh

Where you need to simulate Command1 button to insert a statement:
 Command1_Click ()

CodePudding user response:

refer to the second floor qq_35075199 response:
miss zhao, didn't see the code oh


I want to use the timer to control click, minimize the form after can still trigger Command1

CodePudding user response:

 Option Explicit 

Private Sub Command1_Click ()
Text1=Val (Text1) + 1
End Sub

Private Sub Form_Load ()
Timer1. Interval=1000
Timer1. Enabled=True
End Sub

Private Sub Timer1_Timer ()
Command1_Click
End Sub

CodePudding user response:

 private Declare Function PostMessage Lib "user32" Alias "PostMessageA" (ByVal hWnd As Long, ByVal wMsg As Long, ByVal wParam As Long, lParam As Any) As Long 
Private Const BM_CLICK=& amp; HF5

Private Sub Timer1_Timer ()
PostMessage Command1. The HWND, BM_CLICK, 0 & amp; , ByVal 0
End Sub

CodePudding user response:

In your program, use the TIMER control, timing calls Command1_Click,

If they are two different programs, need to enumerate window, enumeration command button again, and finally to send his message,

CodePudding user response:

 Private Function SendClick (HWND As Long, mX, As Long As mY Long) 
'
click messages sentDim As Long I

I=PostMessage (HWND, WM_LBUTTONDOWN, 0, (mX And & amp; HFFFF) + (mY And & amp; HFFFF) * & amp; H10000)
I=PostMessage (HWND, WM_LBUTTONUP, 0, (mX And & amp; HFFFF) + (mY And & amp; HFFFF) * & amp; H10000)
End the Function
  • Related