The online community for software testing & quality assurance professionals
 
 
Calendar   Today's Topics
Sponsors:




Lost Password?

Home
BetaSoft
Blogs
Jobs
Training
News
Links
Downloads



Testing Tools >> AutomatedQA / SmartBear TestComplete

MrJavaGuy
Moderator


Reged: 08/25/01
Posts: 537
Re: how to disable keyboard and mouse during script running?
      09/02/04 07:54 AM

Hi,

quote:

I feel this is quite necessary. :-)

Well, I've made an additional investigation and found a way to do this: The BlockInput function from the User32.dll has the needed functionality. In the following example the 'StopKeyMouse' routine denies any user input and the 'ResumeKeyMouse' function allows it again. Please note that you always can press Ctrl-Alt-Delete and the user input will be restored.

[VBScript]
code:
Sub StopKeyMouse
Set Def_DLL = DLL.DefineDLL("USER32")
Def_Proc = Def_DLL.DefineProc("BlockInput", vt_b1, vt_b1)
Set Lib = DLL.Load("USER32.DLL", "USER32")
Lib.BlockInput(True)
End Sub

Sub ResumeKeyMouse
Set Def_DLL = DLL.DefineDLL("USER32")
Def_Proc = Def_DLL.DefineProc("BlockInput", vt_b1, vt_b1)
Set Lib = DLL.Load("USER32.DLL", "USER32")
Lib.BlockInput(False)
End Sub

Sub TestNotepad
Set p = Sys.Process("notepad")
Set w = p.Window("Notepad", "*")
w.Activate

StopKeyMouse

For i = 30 To 0 Step -1
Call Sys.Keys(IntToStr(i) + "[Enter]")
Call Sys.Delay(200)
Next

Call w.MainMenu.Click("Help|About Notepad")
Set w = p.Window("#32770", "About Notepad")
w.Activate
Call Sys.Delay(500)
w.Window("Button", "OK").Click

ResumeKeyMouse
End Sub



Post Extras Print Post   Remind Me!     Notify Moderator


Entire topic
Subject Posted by Posted on
* how to disable keyboard and mouse during script running? infomagic 08/31/04 10:39 PM
. * * Re: how to disable keyboard and mouse during script running? MrJavaGuy   09/01/04 09:46 AM
. * * Re: how to disable keyboard and mouse during script running? infomagic   09/01/04 08:21 PM
. * * Re: how to disable keyboard and mouse during script running? MrJavaGuy   09/02/04 07:54 AM
. * * Re: how to disable keyboard and mouse during script running? infomagic   09/05/04 10:37 PM
. * * Re: how to disable keyboard and mouse during script running? nolivo   09/09/04 06:13 AM
. * * Re: how to disable keyboard and mouse during script running? MrJavaGuy   09/10/04 07:27 AM
. * * Re: how to disable keyboard and mouse during script running? nolivo   09/10/04 07:49 AM

Extra information
0 registered and 12 anonymous users are browsing this forum.

Moderator:  NickAQA, Robert Martin, martinh, brentpaine 



Forum Permissions
      You cannot start new topics
      You cannot reply to topics
      HTML is disabled
      UBBCode is enabled

Rating:
Thread views: 4208

Rate this thread

Jump to

Contact Us | Privacy statement SQAForums

Powered by UBB.threads™ 6.5.5