CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 3 of 3
  1. #1
    Join Date
    Nov 1998
    Posts
    23

    detecting key and mouse clicks inside a loop!?



    Im trying to detect either a mouse click or a keypress while runing a for/next loop. is there a command that will allow me to check for such events while inside a loop.


    for x=1 to infinity

    'i want to check for a mouse or keypress here

    next


    as you probably know while aloop is running all operations suspend as far as

    normal VB event go and they are not detected.


    Thanks.



  2. #2
    Join Date
    Apr 1999
    Location
    Rotterdam, Netherlands
    Posts
    278

    Re: detecting key and mouse clicks inside a loop!?



    Hi

    First you need to insert DoEvents in the loop. This makes sure your program can process any messsages.

    Second, you have to need a boolean to see if the mouse is clicked or a key is pressed (set it to true if it is -> do this in the Click and KeyDown events)

    Check in the loop if the boolean is true.

    This should work.


    Hope this helps


    Crazy D

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured