Feedback
 
Did this article resolve your question/issue?

   

Your feedback is appreciated.

Please tell us how we can make this article more useful. Please provide us a way to contact you, should we need clarification on the feedback provided or if you need further assistance.

Characters Remaining: 1025

 


Article

How To Call WIN32 API Function: keybd_event

« Go Back

Information

 
Article Number000001687
EnvironmentProduct: Progress
Version: All supported versions
Product: OpenEdge
Version: All supported versions
OS: Windows
Other: N/A
Question/Problem Description
How To Call WIN32 API Function: keybd_event
Steps to Reproduce
Clarifying Information
Error Message
Defect/Enhancement Number
Cause
Resolution
By using calls to the Windows keybd_event API function, a Progress ABL application can perform tasks as though the user had clicked on the Start menu button, or pressed the Caps Lock key, etc. For a complete listing of the many events this API function can perform, do a Web search using the string "Virtual-Key Codes" and/or "keybd_event".

This example demonstrates how to activate the Caps Lock using the keybd_event API function. In this example we use the virtual key value of 20 that corresponds to the Caps Lock key:

DEFINE VARIABLE intResult AS INTEGER NO-UNDO.

PROCEDURE keybd_event EXTERNAL "USER32.DLL":
    DEFINE INPUT  PARAMETER bVk         AS SHORT NO-UNDO.
    DEFINE INPUT  PARAMETER bScan       AS SHORT NO-UNDO.
    DEFINE INPUT  PARAMETER dwFlags     AS LONG  NO-UNDO.    
    DEFINE INPUT  PARAMETER dwExtraInfo AS LONG  NO-UNDO.    
    DEFINE RETURN PARAMETER intResult   AS LONG  NO-UNDO.
END PROCEDURE.

RUN keybd_event (20, 0, 0, 0, OUTPUT intResult).

IF intResult = 1 THEN    
    MESSAGE "Caps Lock is ON" 
        VIEW-AS ALERT-BOX.
ELSE    
    MESSAGE "Caps Lock is OFF"
        VIEW-AS ALERT-BOX.

 
Workaround
Notes
References to other documentation:

Progress article(s):
000057953, "How to Call WIN32 API Function: GetKeyState"
Attachment 
Last Modified Date9/13/2015 3:22 AM