BUG: GP Fault When KEYSTAT.VBX Used in Two or More Apps
ID: Q121681
|
The information in this article applies to:
-
Microsoft Visual Basic Professional Edition for Windows, version 3.0
SYMPTOMS
When the KEYSTAT.VBX control is used in more than one application, and the
parent window is minimized, the application causes a general protection
(GP) fault.
STATUS
Microsoft has confirmed this to be a bug in the Microsoft product listed
at the beginning of this article. We are researching this problem and will
post new information here in the Microsoft Knowledge Base as it becomes
available.
WORKAROUND
To work around this problem, use the Windows API GetKeyboardState function
directly as in the following example:
- Start a new project in Visual Basic. Form1 is created by default.
- Add the following code to the (general) (declarations) section
Declare Sub GetKeyboardState Lib "User" (ByVal lpKeyState As String)
Const VK_SHIFT = &H10
Const VK_CAPITAL = &H14
Const VK_NUMLOCK = &H90
- Place a command button (Command1) on Form1, and add the following code
to the Command1 Click event:
Sub Command1_Click ()
Dim keys As String
keys = Space$(256)
GetKeyboardState keys
If &H1 = (Asc(Mid(keys, VK_CAPITAL + 1, 1)) And &H1) Then
Debug.Print "Caps lock"
Else
Debug.Print "non caps"
End If
If &H1 = (Asc(Mid(keys, VK_NUMLOCK + 1, 1)) And &H1) Then
Debug.Print "Num lock"
Else
Debug.Print "non lock"
End If
End Sub
- Run the application.
Additional query words:
3.00 buglist3.00 gpf
Keywords :
Version : WINDOWS:3.0
Platform : WINDOWS
Issue type :