[Last Call] Learn about multicloud storage options and how to improve your company's cloud strategy. Register Now

x
?
Solved

Shift key at Start Up

Posted on 2002-05-30
2
Medium Priority
?
241 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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 200 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

Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

Question has a verified solution.

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

When trying to find the cause of a problem in VBA or VB6 it's often valuable to know what procedures were executed prior to the error. You can use the Call Stack for that but it is often inadequate because it may show procedures you aren't intereste…
When designing a form there are several BorderStyles to choose from, all of which can be classified as either 'Fixed' or 'Sizable' and I'd guess that 'Fixed Single' or one of the other fixed types is the most popular choice. I assume it's the most p…
Show developers how to use a criteria form to limit the data that appears on an Access report. It is a common requirement that users can specify the criteria for a report at runtime. The easiest way to accomplish this is using a criteria form that a…
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…
Suggested Courses

656 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