Home > Software engineering >  Request a page program, run vb program, automatically open a web page, timing every day at 3, 5, sim
Request a page program, run vb program, automatically open a web page, timing every day at 3, 5, sim

Time:11-10

Request a page program, requirements:
Run the vb program, after namely open from1 window, the window with webbrower open a web page, such as baidu home page, vb time 3 PM every day, 5 points, simulation of the mouse click a coordinate once or several times,
Don't need to click on any button, etc.,

CodePudding user response:

Use two API, an API is moving the mouse, a mouse click is API,

CodePudding user response:

reference 1st floor vansoft response:
with two API, an API is moving the mouse, a mouse click is API,


Can help to do a vb engineering document?

CodePudding user response:

This use clswindow framework is too simple, a few lines of code, you could just had a method named ClickPoint inside, use reference: https://www.kancloud.cn/sysdzw/clswindow/1480410

related application case reference:
05 circle with the mouse https://www.kancloud.cn/sysdzw/clswindow/1488910
According to the https://www.kancloud.cn/sysdzw/clswindow/1525000 ID into tencent class

CodePudding user response:

reference version of reply: 3/f
this use clswindow framework is too simple, a few lines of code, you could just had a method named ClickPoint inside, use reference: https://www.kancloud.cn/sysdzw/clswindow/1480410

case reference:
05 circle with the mouse https://www.kancloud.cn/sysdzw/clswindow/1488910
08 into tencent classroom by ID https://www.kancloud.cn/sysdzw/clswindow/1525000


This site is good

CodePudding user response:

, all trials, and search for related files saw, is really can't understand,

Now my code is:
=========================
Private Declare Function SetCursorPos Lib "user32" (ByVal x As Long, ByVal y As Long) As Long
Private Declare Sub mouse_event Lib "user32" (ByVal dwFlags As Long, ByVal dx As Long, ByVal dy As Long, ByVal cButtons As Long, ByVal dwExtraInfo As Long)
Private Declare Sub Sleep Lib "kernel32" (ByVal dwMilliseconds As Long)

Private Sub Timer1_Timer ()
If the adrenaline-charged (Now)=22 Or Hour (Now)=21 Then
If Minute 50 Then (Now)=
WebBrowser4. Navigate the Trim (Text1. Text)
Sleep 2000 'wait for page load
Mouse_event MOUSEEVENTF_ABSOLUTE + MOUSEEVENTF_MOVE + MOUSEEVENTF_LEFTDOWN + MOUSEEVENTF_LEFTUP, 345, 211, 0, 0
End the If
End the If
===================
There are two problems, 1, the current hours of 50 points, page will refresh every 2 seconds, 2, and will not click of the mouse coordinates,

Need to how to modify?
Thank you for your attention!

CodePudding user response:

 
Private Declare Function SetCursorPos Lib "user32" (ByVal x As Long, ByVal y As Long) As Long
Private Declare Sub mouse_event Lib "user32" (ByVal dwFlags As Long, ByVal dx As Long, ByVal dy As Long, ByVal cButtons As Long, ByVal dwExtraInfo As Long)
Private Declare Sub Sleep Lib "kernel32" (ByVal dwMilliseconds As Long)
Dim isHasDone As Boolean
Private Sub Timer1_Timer ()
If the adrenaline-charged (Now)=22 Or Hour (Now)=21 Then
If Minute 50 Then (Now)=
If Not isHasDone Then
IsHasDone=True
WebBrowser4. Navigate the Trim (Text1. Text)
Sleep 2000 'wait for page load
Mouse_event MOUSEEVENTF_ABSOLUTE + MOUSEEVENTF_MOVE + MOUSEEVENTF_LEFTDOWN + MOUSEEVENTF_LEFTUP, 345, 211, 0, 0
End the If
The Else
IsHasDone=False
End the If
End the If

CodePudding user response:

refer to 6th floor version of reply:
 
Private Declare Function SetCursorPos Lib "user32" (ByVal x As Long, ByVal y As Long) As Long
Private Declare Sub mouse_event Lib "user32" (ByVal dwFlags As Long, ByVal dx As Long, ByVal dy As Long, ByVal cButtons As Long, ByVal dwExtraInfo As Long)
Private Declare Sub Sleep Lib "kernel32" (ByVal dwMilliseconds As Long)
Dim isHasDone As Boolean
Private Sub Timer1_Timer ()
If the adrenaline-charged (Now)=22 Or Hour (Now)=21 Then
If Minute 50 Then (Now)=
If Not isHasDone Then
IsHasDone=True
WebBrowser4. Navigate the Trim (Text1. Text)
Sleep 2000 'wait for page load
Mouse_event MOUSEEVENTF_ABSOLUTE + MOUSEEVENTF_MOVE + MOUSEEVENTF_LEFTDOWN + MOUSEEVENTF_LEFTUP, 345, 211, 0, 0
End the If
The Else
IsHasDone=False
End the If
End the If




Test, still I can't, or can't simulate click of the mouse, there has been no response,
It is no way out...
Also need to modify?