SPONSORS:






User Tag List

Thanks Thanks:  0
Likes Likes:  0
Dislikes Dislikes:  0
Results 1 to 8 of 8
  1. #1
    Junior Member
    Join Date
    Jul 2004
    Posts
    5
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Total Downloaded
    0

    how to disable keyboard and mouse during script running?

    Hi buddies,

    can you tell me how to disable keyboard and mouse during script running? because TestComplete is an interface-based tool, mouse and keyboard events may hang up the running script. is there any good sulution? thx.

    regards
    Hi buddy, u can call me BIGBUG!

  2. #2
    Senior Member
    Join Date
    Aug 2001
    Posts
    529
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Total Downloaded
    0

    Re: how to disable keyboard and mouse during script running?

    Hi,

    We are not aware of a way to do this, but even if there was a way it would cause you problems as you will not be able to interrupt the script execution.
    Eric Holton
    Microsoft Corp.

  3. #3
    Junior Member
    Join Date
    Jul 2004
    Posts
    5
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Total Downloaded
    0

    Re: how to disable keyboard and mouse during script running?

    How about this idea...

    disable all the other events, and only allow the pre-defined interrupt keys or key sets?

    thx...

    I feel this is quite necessary. :-)
    Hi buddy, u can call me BIGBUG!

  4. #4
    Senior Member
    Join Date
    Aug 2001
    Posts
    529
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Total Downloaded
    0

    Re: how to disable keyboard and mouse during script running?

    Hi,

    I feel this is quite necessary. :-)
    <font size="2" face="Verdana, Arial, Helvetica">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]
    </font><blockquote><font size="1" face="Verdana, Arial, Helvetica">code:</font><hr /><pre style="font-size:x-small; font-family: monospace;">Sub StopKeyMouse
    Set Def_DLL = DLL.DefineDLL(&quot;USER32&quot
    Def_Proc = Def_DLL.DefineProc(&quot;BlockInput&quot;, vt_b1, vt_b1)
    Set Lib = DLL.Load(&quot;USER32.DLL&quot;, &quot;USER32&quot
    Lib.BlockInput(True)
    End Sub

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

    Sub TestNotepad
    Set p = Sys.Process(&quot;notepad&quot
    Set w = p.Window(&quot;Notepad&quot;, &quot;*&quot
    w.Activate

    StopKeyMouse

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

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

    ResumeKeyMouse
    End Sub</pre><hr /></blockquote><font size="2" face="Verdana, Arial, Helvetica">
    Eric Holton
    Microsoft Corp.

  5. #5
    Junior Member
    Join Date
    Jul 2004
    Posts
    5
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Total Downloaded
    0

    Re: how to disable keyboard and mouse during script running?

    many thx. :-)
    Hi buddy, u can call me BIGBUG!

  6. #6
    Senior Member
    Join Date
    Oct 2002
    Posts
    254
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Total Downloaded
    0

    Re: how to disable keyboard and mouse during script running?

    Just curious, Eric, where did you find the info about the BlockInput function?

    Thanks,
    Nick

  7. #7
    Senior Member
    Join Date
    Aug 2001
    Posts
    529
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Total Downloaded
    0

    Re: how to disable keyboard and mouse during script running?

    Hi Nick,

    I had found the article on this function when I was digging in the MSDN Library. Here is the link to this article:
    http://msdn.microsoft.com/library/en...BlockInput.asp
    Eric Holton
    Microsoft Corp.

  8. #8
    Senior Member
    Join Date
    Oct 2002
    Posts
    254
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Total Downloaded
    0

    Re: how to disable keyboard and mouse during script running?

    Thanks, Eric.

    -Nick

 

 

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Search Engine Optimisation provided by DragonByte SEO v2.0.36 (Pro) - vBulletin Mods & Addons Copyright © 2016 DragonByte Technologies Ltd.
Resources saved on this page: MySQL 10.71%
vBulletin Optimisation provided by vB Optimise v2.6.4 (Pro) - vBulletin Mods & Addons Copyright © 2016 DragonByte Technologies Ltd.
User Alert System provided by Advanced User Tagging v3.2.8 (Pro) - vBulletin Mods & Addons Copyright © 2016 DragonByte Technologies Ltd.
vBNominate (Lite) - vBulletin Mods & Addons Copyright © 2016 DragonByte Technologies Ltd.
Feedback Buttons provided by Advanced Post Thanks / Like (Pro) - vBulletin Mods & Addons Copyright © 2016 DragonByte Technologies Ltd.
Username Changing provided by Username Change (Free) - vBulletin Mods & Addons Copyright © 2016 DragonByte Technologies Ltd.
BetaSoft Inc.
Digital Point modules: Sphinx-based search
All times are GMT -8. The time now is 02:32 AM.

Copyright BetaSoft Inc.