Solved

Shift key at Start Up

Posted on 2002-05-30
2
230 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_
Comment Utility
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
Comment Utility
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

Highfive + Dolby Voice = No More Audio Complaints!

Poor audio quality is one of the top reasons people don’t use video conferencing. Get the crispest, clearest audio powered by Dolby Voice in every meeting. Highfive and Dolby Voice deliver the best video conferencing and audio experience for every meeting and every room.

Join & Write a Comment

Introduction I needed to skip over some file processing within a For...Next loop in some old production code and wished that VB (classic) had a statement that would drop down to the end of the current iteration, bypassing the statements that were c…
I was working on a PowerPoint add-in the other day and a client asked me "can you implement a feature which processes a chart when it's pasted into a slide from another deck?". It got me wondering how to hook into built-in ribbon events in Office.
As developers, we are not limited to the functions provided by the VBA language. In addition, we can call the functions that are part of the Windows operating system. These functions are part of the Windows API (Application Programming Interface). U…
Get people started with the process of using Access VBA to control Excel using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Excel. Using automation, an Access application can laun…

771 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

Need Help in Real-Time?

Connect with top rated Experts

15 Experts available now in Live!

Get 1:1 Help Now