SendKeys

Top  Previous  Next

Prototype

 

SendKeys (strWindowCaption, strKeys, boolShift, boolAlt, boolCtrl, boolVirtual, boolFore)

 

Description

 

Sends a keys sequence to a window.

 

Parameters

 

StrWindowCaption: string representing the name of the window where a keys sequence can be sent.

 

StrKeys: string corresponding to the text or the object to send.

 

BoolShift: logical value true or false. If true is set there will be the StrKeys value and the key Shift.

 

BoolCtrl: logical value true or false. If true is set there will be the StrKeys value and the key Ctrl.

 

BoolAlt: logical value true or false. If true is set there will be the StrKeys value and the key Alt.

 

BoolVirtual: logical value true or false. If true is set, it shows that a key is sent and not a letter.

 

BoolFore: logical value true or false. If true is set, the window is left in front or else it returns on the first window.

 

Returned value

 

None.

 

Notes

 

In order to send a key (BoolVirtual=true) it needs to pass as parameter StrKeys one of the following strings, in accordance with the key to be sent. For each command it can be sent just a key.

 

VK_TAB

VK_BACK

VK_RETURN

VK_CLEAR

VK_MENU

VK_PAUSE

VK_CAPITAL

VK_ESCAPE

VK_END

VK_HOME

VK_NEXT

VK_PRIOR

VK_LEFT

VK_RIGHT

VK_UP

VK_DOWN

VK_PRINT

VK_SNAPSHOT

VK_INSERT

VK_DELETE

VK_HELP

VK_F1

VK_F2

VK_F3

VK_F4

VK_F5

VK_F6

VK_F7

VK_F8

VK_F9

VK_F10

VK_F11

VK_F12

VK_NUMLOCK

 

It is not possible to send more than a key for each command.

 

Example

 

// Store a table handle

TableOne:=TableOpen('c:\archive\index\','clients.db');

 

// Move to the first record of the table

TableFirst(TableOne);

 

// Start the loop

While not TableEOF(TableOne) do

 

Begin

 

// Set the edit mode

TableEdit(TableOne);

 

// Send a keys sequence

SendKeys('Invoices', TableGetFieldByName(TableOne,'COMPANY TITLE'), False, False, false);

 

// Move to the next record

TableNext(TableOne);

End;

 

// Close the table

TableClose(TableOne);