Results 1 to 4 of 4

Thread: Press Button on Key Press

  1. #1

    Thread Starter
    Frenzied Member
    Join Date
    Aug 2000
    Location
    Birmingham, AL
    Posts
    1,276

    Press Button on Key Press

    In this program, the 'X' key is registered using RegisterHotKey( )
    and the form is subclassed to process the message when
    the 'X' key is pressed. How can I show a button press of the button
    on the form when the key is pressed? I tried to SendMessage( )
    WM_LBUTTONDOWN and WM_LBUTTONUP, but that is done so
    fast that the keypress can't be seen. This is a poor solution.
    Any Ideas?

  2. #2
    Megatron
    Guest
    So you're trying to graphically display a button being pressed? Why not send the BM_SETSTATE message? Just pause for about 100 milliseconds between the 2 messages so that you can see it.

  3. #3

    Thread Starter
    Frenzied Member
    Join Date
    Aug 2000
    Location
    Birmingham, AL
    Posts
    1,276
    Use a timer? Yeah, that works.
    Is there a better way?

  4. #4
    Megatron
    Guest
    No, don't use the Timer componet. What I meant was create your own pause routine e.g.
    VB Code:
    1. Sub Pause(amount As Integer)
    2.     Start = Timer
    3.     Do While Timer < Start + amount
    4.        DoEvents
    5.     Loop
    6. End Sub

    Then to pause for 100 ms, you would use:
    Code:
    Call Pause(0.1)

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