Solved

Shift key at Start Up

Posted on 2002-05-30
2
238 Views
Last Modified: 2010-08-05
How can I determine in VB6 if the Shift key is pressed when my app starts?
0
Comment
Question by:craigdawson
  • 2
2 Comments
 
LVL 3

Expert Comment

by:Elmo_
ID: 7044628
Craig,

Should find everything you need here.

http://216.26.161.91/vbapi/ref/g/getkeystate.html

Cheers,

Ed.
0
 
LVL 3

Accepted Solution

by:
Elmo_ earned 50 total points
ID: 7044639
Craig,

Just in case:

'In A Module
Public Declare Function GetKeyState Lib "user32.dll" (ByVal nVirtKey As Long) As Integer


' Determine whether the Shift key is currently being pressed.

Private Sub Command1_Click()
    Dim keystate As Integer
   
    keystate = GetKeyState(vbKeyShift)
    ' Check the &H8000 bit of the return value.
    If keystate And &H8000 Then
        Debug.Print "The Shift key is currently down."
    Else
        Debug.Print "The Shift key is currently up."
    End If
End Sub


Highlight "vbKeyShift" and press F1 and you should see all the other constants for the Keyboard Keys.  

Cheers,

Ed.
0

Featured Post

Free Tool: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Introduction In a recent article (http://www.experts-exchange.com/A_7811-A-Better-Concatenate-Function.html) for the Excel community, I showed an improved version of the Excel Concatenate() function.  While writing that article I realized that no o…
Since upgrading to Office 2013 or higher installing the Smart Indenter addin will fail. This article will explain how to install it so it will work regardless of the Office version installed.
Get people started with the utilization of class modules. Class modules can be a powerful tool in Microsoft Access. They allow you to create self-contained objects that encapsulate functionality. They can easily hide the complexity of a process from…
This lesson covers basic error handling code in Microsoft Excel using VBA. This is the first lesson in a 3-part series that uses code to loop through an Excel spreadsheet in VBA and then fix errors, taking advantage of error handling code. This l…

730 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question