28 May 2013, 12:19 | #1 |
Registered User
Join Date: Apr 2007
Location: Poland
Posts: 337
|
Sending keys or simulate them properly on WinUAE window.
Hello Toni. I have few questions.
I'm simulate keys pressing and releasing by this Delphi code: Code:
procedure KeyDownUp(KeyToSend : Byte; KeyDown : boolean); const DownUp_Flags_Arr : array[boolean] of DWORD = (0, KEYEVENTF_KEYUP); Extended_Flags_Arr : array[boolean] of DWORD = (0, KEYEVENTF_EXTENDEDKEY); var Input : TagINPUT; KeyExtended : boolean; begin Input.Itype := INPUT_KEYBOARD; Input.ki.wVK := KeyToSend; Input.ki.wScan := MapVirtualKey(KeyToSend, 0); KeyExtended := KeyToSend in [VK_CONTROL, VK_LCONTROL, VK_RCONTROL, VK_UP, VK_DOWN, VK_LEFT, VK_RIGHT, VK_HOME, VK_END, VK_PRIOR, VK_NEXT, VK_INSERT, VK_DELETE, VK_MENU]; Input.ki.dwFlags := DownUp_Flags_Arr[not KeyDown] or Extended_Flags_Arr[KeyExtended]; Input.ki.time := 0; SendInput(1, Input, SizeOf(Input)); end; So it is possible to simulate keys even if window is now on foreground? Can you give some code examples? It can be in C++ if it is in pure WinAPI I probable can translate it to Delphi. Other question: it is possible to use WM_KEYDOWN/UP by Send/PostMessage functions - for main Window? I can only send VK_F12 to show properties GUI in that way. Trying other keys fail :/ I do now have possiblity and enough knowledge to change WinUAE's original C++ source code and tecompilte it. Last problem. From first code I tried to send VK_DIVIDE key (vkCode $6F), but I cannot press numeric "/". Instead of that EditKeys under Classic WB with Great Britan default map file while testing show me I sending normal "\" (near BackSpace key). But that key have hex vkCode: $DC (and it is called VK_OEM_5 in MSDN specification). How to simulate numeric key "/" properly? I have NumLock always on. Thanks in advice for all help and example code. And sorry for my bad English. |
29 May 2013, 11:59 | #2 |
WinUAE developer
Join Date: Aug 2001
Location: Hämeenlinna/Finland
Age: 49
Posts: 26,505
|
WinUAE uses RawInput (It is the only method that allows to read all special keys, including windows keys, pause/break etc..), most Windows event injections won't work with rawinput.
One solution is to use WinUAE named pipe. It supports all kinds of input event injection. (keys, joysticks, mouse movement etc..) |
30 May 2013, 21:15 | #3 |
Registered User
Join Date: Apr 2007
Location: Poland
Posts: 337
|
Ok, can you show me example of pipe sending some rawkeycode (for example numeric "/"). I only know how to use dbg... like you probable remember from our early contact on PMs.
|
07 June 2013, 07:57 | #4 |
WinUAE developer
Join Date: Aug 2001
Location: Hämeenlinna/Finland
Age: 49
Posts: 26,505
|
"EVT <event name> <state value>"
<event name> = input event name, same as in config file and in source package inputevents.def. (KEY_A for example). Note that it supports all kinds of input events, it is not limited to keys. Keys and button <state value> is either press (1) or release (0). |
08 June 2013, 22:37 | #5 |
Registered User
Join Date: Apr 2007
Location: Poland
Posts: 337
|
Ok, tbank you. And one more question. Is it possible without global keyboard hook (WH_KEYBOARD_LL), which need admin right to trap Ctrl+F11 combination and handle it by my self? Because when assigning own function for "PCsuxRox" or even "AmigaPowah" and WM_KEYDOWN message, when returning 0 and exit from function, key is still pass. Probable because you handle it raw input by yourself. So it is no method to trap it and do some code and execute later in my wrapper dll? Ofcourse without changing original C++ source code of WinUAE emulator.
|
Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) | |
Thread Tools | |
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
Using a predefined res. to display the WB properly when in window mode -RTG'd WB only | NewDeli | New to Emulation or Amiga scene | 60 | 16 October 2009 08:41 |
WinUAE: Sumea Demo doesn't work properly | Leonid | support.WinUAE | 7 | 06 May 2008 20:33 |
WinUAE not starting properly | CoCan | support.WinUAE | 4 | 31 May 2007 00:34 |
How can I have WinUAE display 320x240 properly? | vwlssknght | support.WinUAE | 12 | 05 July 2006 14:03 |
Can WinUAE simulate a serial cable? | Dangerous Benos | support.WinUAE | 1 | 17 April 2003 22:14 |
|
|