SENDKEYS.OCX PROGRAMMING REFERENCE MANUAL PART NUMBER 99875470-1 DECEMBER 2009 REGISTERED TO ISO 9001:2008 1710 Apollo Court Seal Beach, CA 90740 Phone: (562) 546-6400 FAX: (562) 546-6301 Technical Support: (651) 415-6800 www.magtek.
Copyright© 2001-2009 MagTek®, Inc. Printed in the United States of America Information in this document is subject to change without notice. No part of this document may be reproduced or transmitted in any form or by any means, electronic or mechanical, for any purpose, without the express written permission of MagTek, Inc. MagTek is a registered trademark of MagTek, Inc. MTMicrIntPINTM is a trademark of MagTek, Inc. Microsoft® is a trademark of Microsoft, Inc. REVISIONS Rev Number 1.
SOFTWARE LICENSE AGREEMENT IMPORTANT: YOU SHOULD CAREFULLY READ ALL THE TERMS, CONDITIONS AND RESTRICTIONS OF THIS LICENSE AGREEMENT BEFORE INSTALLING THE SOFTWARE PACKAGE. YOUR INSTALLATION OF THE SOFTWARE PACKAGE PRESUMES YOUR ACCEPTANCE OF THE TERMS, CONDITIONS, AND RESTRICTIONS CONTAINED IN THIS AGREEMENT. IF YOU DO NOT AGREE WITH THESE TERMS, CONDITIONS, AND RESTRICTIONS, PROMPTLY RETURN THE SOFTWARE PACKAGE AND ASSOCIATED DOCUMENTATION TO THE ABOVE ADDRESS, ATTENTION: CUSTOMER SUPPORT.
Table of Contents SECTION 1. INTRODUCTION..................................................................................................................... 1 SECTION 2. PROPERTIES ......................................................................................................................... 3 NAME PROPERTY................................................................................................................................... 3 ALLCAPS PROPERTY .........................................
SECTION 1. INTRODUCTION Use the SendKeys.OCX to send keystrokes to a legacy windows application that does not support COM Objects. The SendKeys.OCX can be used in conjunction with other controls to send output as keystrokes; a perfect example is MagTek’s Keyboard Wedge Reader OCX. The Keyboard Wedge Reader sends keystrokes as keyboard data. The Keyboard Wedge OCX captures the keystrokes from the keyboard input. The SendKeys.
SendKeys.
SECTION 2. PROPERTIES NAME PROPERTY Sets and Returns the control name. Syntax SendKeys.Name[ = value] The Name property syntax has these parts: Part Value Description A string value specifying the name of the control. Example Assume a SendKeys control is named ‘SendKeys1’ Msgbox SendKeys1.Name Displays “SendKeys1” in a message box. SendKeys1.Name = “SendKeys2” Changes the name of the control to ‘SendKeys2’ ALLCAPS PROPERTY Sets and returns the AllCaps property. Syntax SendKeys.
SendKeys.OCX TARGETAPP PROPERTY Sets and returns the TargetApp property. Syntax SendKeys.TargetApp[ = value] The TargetApp property syntax has these parts: Part Value Description A string value representing the Target Application that will receive the keystrokes. Remarks If TargetApp is left blank then the SendKeys control will send the keystrokes to the active window. If the TargetApp property is not blank, the SendKeys control will activate the window referenced by the TargetApp property.
Properties WAITFORKEYS PROPERTY Sets and returns the WaitForKeys property. Syntax SendKeys.WaitForKeys[ = value] The WaitForKeys property syntax has these parts: Part Value Description A Boolean Value representing the status of WaitForKeys. Remarks If WaitForKeys is True then SendKeys.OCX will wait for the system to process the keys before continuing. If WaitForKeys is False then the keystrokes will be sent without waiting for the system to process the keystrokes. Example SendKeys.
SendKeys.
SECTION 3 METHODS SENDDATA METHOD Sends the keystrokes. Syntax SendKeys.SendData[ = strData] The SendData method syntax has these parts: Part Description strData The SendData method is used to send the keystrokes. Remarks The SendData method is the method that sends the keystrokes to the computer. The SendData method can also use Keywords to represent keystrokes. If the keystrokes are sent successfully then the method will return 0.
SendKeys.
SECTION 4. EXAMPLE Private Sub Command1_Click() Dim Response As Integer 'Set the Target Application to Untitled - Notepad SendKeys1.TargetApp = "Untitled - Notepad" 'Do not wait for this application to become active first SendKeys1.WaitForApp = False 'Do not wait for the keystrokes to be processed SendKeys1.WaitForKeys = False 'Send the Keystrokes - Hello World! and the Enter key Response = SendKeys1.SendData("Hello World!{ENTER}") Select Case Response Case 0 txtStatus.Text = "Success" Case 5 txtStatus.