INKEY$ in VB5 
Author Message
 INKEY$ in VB5

Is there way (method, procedure etc.) in Visual Basic that emulates
INKEY$ in QBasic? I read the Language Reference re Keypress, KeyDown
etc., and I may as well be trying to read the Rosetta stone.
 What I want to do is break out of a DO _ LOOP with a keystroke.
 This is a piece of cake in QBasic - how do I do it In VB5?
 Any help via email would be greatly appreciated.
 Thanks in advance,
 Vaughn



Fri, 01 Dec 2000 03:00:00 GMT  
 INKEY$ in VB5

Quote:
> >You probably can't. Try setting up a button, set this code in the click
> event;
> >DO
> >LOOP

> >Run it and try breaking the loop.
> >On my machines, and in delphi also, even CTRL-ALT-DEL doesn't interrupt it.
> Visual Basic shares a lot of cmds with QBasic, but it doesn't share a
> similar style. What are you trying to do? If, as I guess, you are trying to
> make some sort of splash screen that goes away when the user hits a key, do
> the following...

Ta, but I wasn't. I discovered it when trying to use Delphi do do
some number-crunching (Lists of prime numbers and the like) so I
could get neatened results, I put the code in a "Do Loop" structure,
but when I tried to click on "stop" it wouldn't let me. I have since
discovered some code to force it to do background processing as well.
Anyway, I would only use QB for that sort of thing now.

Simon.



Sun, 03 Dec 2000 03:00:00 GMT  
 INKEY$ in VB5

'
'**********************************************************************
'* Category :  Code Functions
'* Procedure:  InKey
'* Changed  :  20-03-1998, 19:47 by :
'* Placed   :  17-06-1998, 23:55 by :
'* Revision :
'*
'* Purpose  :
'* To check of the given key or mousebutton is pressed (for example
'* during lostfocus-events)
'* Example  :
'* If InKey(1) = True Then Debug.Print "Left mousebutton is pressed!"
'* If InKey(9) = True Then Debug.Print "Tab-key is pressed!"
'* See \VB\WINAPI\win30api.txt for the 'VK_...' -keys.
'**********************************************************************
'
'[CodeLib message : Move next section into General Declarations...]
'General Declarations / Constants for procedure : InKey
'Declare Function GetKeyState Lib "User" (ByVal nVirtKey As Integer) As
Integer
'
Function InKey (KeyCode As Integer) As Integer
    '
    On Error Resume Next
    '
    Dim a%
    '
    a% = GetKeyState(KeyCode)
    If Abs(a%) > 100 Then
        Debug.Print "Key (" & KeyCode & ", " & a% & ") = pressed!"
        InKey = True
    End If
    '
End Function


Quote:
>Is there way (method, procedure etc.) in Visual Basic that emulates
>INKEY$ in QBasic? I read the Language Reference re Keypress, KeyDown
>etc., and I may as well be trying to read the Rosetta stone.
> What I want to do is break out of a DO _ LOOP with a keystroke.
> This is a piece of cake in QBasic - how do I do it In VB5?
> Any help via email would be greatly appreciated.
> Thanks in advance,
> Vaughn



Sun, 03 Dec 2000 03:00:00 GMT  
 
 [ 3 post ] 

 Relevant Pages 

1. VB5's INKEY$ Equivalent...URGENT!

2. INKEY vs INP(&h60)

3. INKEY$ vs. INT(&H60)

4. Alternative to INKEY$ - INP(&H60)

5. Key press combination with INKEY$?

6. Alternative to INKEY$

7. Help with the INKEY$ function for deleting...

8. Inkey$ Sux!

9. INP() address for INKEY$ (and why?)

10. INKEY$

11. INKEY$

12. PLEASE HELP: Resetting INKEY$?

 

 
Powered by phpBB® Forum Software