0% found this document useful (0 votes)
293 views3 pages

How To Simulate A Key Pressed: Oracle Forms Francois Degrelle

This document describes how to simulate keyboard key presses in an Oracle Forms application using the d2kwutil library. The sendkeys() function allows specifying keystrokes to send to a window, using special characters for modifiers like shift, control and alt. Examples demonstrate sending an end key or menu shortcut. The d2kwutil library files need to be downloaded, installed in the devsuite bin folder, and added to the forms path for use.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
293 views3 pages

How To Simulate A Key Pressed: Oracle Forms Francois Degrelle

This document describes how to simulate keyboard key presses in an Oracle Forms application using the d2kwutil library. The sendkeys() function allows specifying keystrokes to send to a window, using special characters for modifiers like shift, control and alt. Examples demonstrate sending an end key or menu shortcut. The d2kwutil library files need to be downloaded, installed in the devsuite bin folder, and added to the forms path for use.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 3

Oracle Forms Francois Degrelle

How to simulate a key pressed

Home page

The purpose is to simulate keyboard key pressing in a Forms application.

Sometimes, you need to simulate a keyboard action at runtime, for instance go to the end of the text
in a Text Item, to add information or simply to put the cursor at the end.

The d2kwutil library offers a function dedicated to this purpose : win_api_shell.sendkeys()

Syntax

PROCEDURE Win_Api_Shell.SendKeys

(hWnd IN PLS_INTEGER,

Keys IN VARCHAR2,

RaiseExceptions IN BOOLEAN DEFAULT FALSE);

Parameters

Target

The Window handle of the window you want to send the keystrokes to. You can get this handle by
using the GET_WINDOW_PROPERTY built-in.

Keystrokes

The keystrokes that you want to send to the window. Use these characters for modifier keys:

Shift = +;
Control = ^;
Alt = %.

Modifiers can be Escaped by enclosing them in braces {}.


To apply the modifiers to a sequence of keys, enclose the keys in brackets, as in "^(abc)". Other
special keys are enclosed in braces thus:

{Backspace}
{Break}
{CapsLock}
{Clear}
{Delete}
{End}
{Enter}
{Esc}
{Help}
{Home}
{Insert}
{NumLock}
{PgDown}
{PgUp}
{PrtSc}
{ScrollLock}
{Tab}
{F1} - {F12}
{Up}
{Down}
{Left}
{Right}

RaiseExceptions If TRUE, then if the procedure fails to send or parse the keystrokes, the explicit
PL/SQL exception NO_DATA_FOUND will be raised

Examples:

 Simulate a END key to go to the end of the text in a Text Item:

win_api_shell.sendkeys(get_window_property('WINDOW1',window_handle),'{End}',
TRUE);

 Simulate a menu action, for instance : Action -> Exit of the standard menu:

win_api_shell.sendkeys(get_window_property('WINDOW1',window_handle),'%(ae)',
TRUE);
D2KWUTIL download and install

I am not sure that d2kwutil is still reachable from the OTN Forms page, but you can download it
here.

o Unzip the file


o Copy d2kwut60.dll and D2kwutil.pll in your <DEVSUITE_HOME>/bin folder
o Compile d2kwutil.pll and generate a .plx that you move in one of the folders pointed by
your FORMS_PATH variable.
o Create a new Forms application
o Attach the d2kwutil.pll

You might also like