MSN climbed stairs and taut curtains on the roof of Monkey Testing - From

xiaoxiao2021-03-06  121

In fact, I just wrote a small program that allows MSN Messenger to change the status of Online / Offline in a very short interval. Moreover, the program has no in-depth use of the MSN's Protocol or SDK, and does not use SendMessage / FindWindow, just written a VBScript with SendKeys:

LoopCount = 5 'show 5 sign-in windows

SET WSHSHELL = WScript.createObject ("wscript.shell")

WSHShell.Appactivate "MSN Messenger"

'Send "Alt F, M, F, Alt F, M, O"

For i = 1 to loopcount

Wshshell.sendKeys "% f"

Wshshell.sendKeys "M"

Wshshell.sendKeys "f"

WScript.sleep 500

Wshshell.sendKeys "% f"

Wshshell.sendKeys "M"

Wshshell.sendKeys "o"

WScript.sleep 500

NEXT

It is also very convenient to write with Visual Basic 6.0, as long as you change a little bit:

Private Declare Sub Sleep Lib "Kernel32" (Byval dwmilliseconds as ring)

Private submmand1_click ()

LoopCount = 5 'show 5 sign-in windows

Set wshshell = creteObject ("wscript.shell")

WSHShell.Appactivate "MSN Messenger"

'Send "Alt F, M, F, Alt F, M, O"

For i = 0 to int (Val (me.text1.text))

Wshshell.sendKeys "% f"

Wshshell.sendKeys "M"

Wshshell.sendKeys "f"

Sleep 500

Wshshell.sendKeys "% f"

Wshshell.sendKeys "M"

Wshshell.sendKeys "o"

Sleep 500

NEXT

End Sub

If you are running not MSN Messenger but Windows Messenger 4.7 / 5.0, you can change the parameters of AppActiVate. I really like this little drama, and there are 5 login windows at a time, very awake. However, I hope everyone should not use the constant climb, which will become DDoS attack, increase the load of the server, the load is large, and the server performance will also affect others. If you always have a bunch of login windows in someone else, it is a pollution.

In fact, in turn, this is a monkey testing program (not enough to completely Smart Monkey). This is also a simplest instance of the GUI automatic test of the Windows program.

转载请注明原文地址:https://www.9cbs.com/read-101835.html

New Post(0)