Send key events (OpenInsight 32-bit Specific)
At 17 NOV 2003 12:26:07PM Clay wrote:
Is there any way to send a key press of the enter key? I have a msg that appears after exporting an xml file, but is executes another one right after that. The problem is that every time it finishes one file, a msg appears telling that its done. I just want to send the enter key press to bypass it. Thanks
At 17 NOV 2003 12:26PM Donald Bakke wrote:
Clay,
Perhaps I'm missing something because of the technical responses you've been getting. However, from what I read it sounds like this is a message box being generated from OI. If so, then why can't you send a CLICK event to the window's OK button?
At 17 NOV 2003 12:26PM Ira Krakow wrote:
Clay,
keybd_event is exported from USER32.DLL. You need to generate a stub function (with DECLARE_FCNS) so OI can recognize the exported function. To do that:
1) Go into SYSPROG. In a record (I create a record called DLL_USER32_EXTRA in SYSPROCS, to set it apart from DLL_USER32, which define the functions OI exports), enter the following two lines.
USER32
LONG STDCALL keybd_event(BYTE, BYTE, LONG, LONG)
2) Save DLL_USER32_EXTRA.
3) In the System Editor Exec Line, enter:
RUN DECLARE_FCNS 'DLL_API_USER32'
If successful, you'll get a message that $KEYBD_EVENT was written to SYSOBJ. This lets OI see Keybd_event.
4) Exit SYSPROG, and log into your application. The code below will pass the ENTER key to a text box (say from a menu item). Uncomment the last two lines to simulate a click - you need to simulate a keyup as well.
declare function keybd_event
rv='
VK_ENTER=13
Scan_Code=0
Flags=0
Extra_Info=0
rv=keybd_event(VK_ENTER, Scan_Code, Flags, Extra_Info)
/* to simulate a button click, add a keyup
Flags=2
rv=keybd_event(VK_ENTER, Scan_Code, Flags, Extra_Info)
*/
Here's a link to keybd_event MSDN Web site:
The virtual keys you can pass are documented here:
Ira
At 17 NOV 2003 12:26PM Gerald Lovel wrote:
Clay,
I know the following code sends a delete key:
keybd_event( 46, 0, 0, 0 )
Similar calls would handle other keys, based on the key mappings in the windows development include files.
But why not set the message to non-display in the interface designer? One caution here, which I encountered just today, is that non-display messages do return a response. If you are checking response for a processing message image, this might cause an error.
Gerald