Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.clipper.visual-objects > #11790
| From | "Karl-Heinz" <invalid@invalid.invalid> |
|---|---|
| Newsgroups | comp.lang.clipper.visual-objects |
| Subject | Re: Sample for SendInput() ? |
| Date | 2018-07-31 16:11 +0200 |
| Message-ID | <fsb90iFovieU1@mid.individual.net> (permalink) |
| References | <pjmtau$dk5$1@news-1.m-online.net> |
Hi Gerhard,
> for a phone dial by our app, we have to do a keyboard simulation.
> Therefor I found the WIN32 function SendInput(). Has somebody a sample
> with VO to do this?
it seems that it´s neccesarry to create a UNION. Here´s what i did so far:
UNION _UnionSendInput
MEMBER mi IS _WINMOUSEINPUT
MEMBER ki IS _winKEYBDINPUT
MEMBER hi IS _winHARDWAREINPUT
STRUCTURE _winINPUT
MEMBER type AS DWORD
MEMBER Input IS _UnionSendInput // <-------
/*
MEMBER mi IS _WINMOUSEINPUT
MEMBER ki IS _winKEYBDINPUT
MEMBER hi IS _winHARDWAREINPUT
*/
STRUCTURE _winHARDWAREINPUT
MEMBER uMsg AS DWORD
MEMBER wParamL AS WORD
MEMBER wParamH AS WORD
STRUCTURE _winKEYBDINPUT
MEMBER wVk AS WORD
MEMBER wScan AS WORD
MEMBER dwFlags AS DWORD
MEMBER time AS DWORD
MEMBER dwExtraInfo AS _WINULARGE_INTEGER // ULONG_PTR ???
STRUCTURE _WINMOUSEINPUT
MEMBER dx AS LONG
MEMBER dy AS LONG
MEMBER mouseData AS DWORD
MEMBER dwFlags AS DWORD
MEMBER time AS DWORD
MEMBER dwExtraInfo AS _WINULARGE_INTEGER // ULONG_PTR ????
DEFINE INPUT_MOUSE := 0 // The event IS a mouse event. Use the mi STRUCTURE
OF the UNION.
DEFINE INPUT_KEYBOARD := 1 // The event IS a keyboard event. Use the ki
STRUCTURE OF the UNION.
DEFINE INPUT_HARDWARE := 2 // The event is a hardware event. Use the hi
structure of the union.
_DLL FUNCTION SendInput ( nInputs AS DWORD , pInputs AS _winINPUT , cbSize
AS INT ) AS DWORD PASCAL:User32.SendInput
-----------------------------------
about the dwExtraInfo member i´m not sure if it´s correct, but at least this
sample works for me. It opens here a Submenu via <Alt> + <L>. Without using
the UNION SendInPut() fails with the errorcode 87 ->
ERROR_INVALID_PARAMETER
----------------------
FUNCTION TestKeyboardSendInPut() AS VOID
LOCAL ip IS _winINPUT
LOCAL dwError AS DWORD
ip.type := INPUT_KEYBOARD
ip.Input.ki.wScan := 0
ip.Input.ki.time := 0
ip.Input.ki.dwExtraInfo := 0
// -----------------------
// Press "Alt" key
ip.Input.ki.wVk := VK_MENU
ip.Input.ki.dwFlags := 0 // 0 for key press
SendInput(1, @ip, _SIZEOF( _winINPUT))
// Press "L" key
ip.Input.ki.wVk := WORD ( Asc ( "L" ))
ip.Input.ki.dwFlags := 0 // 0 for key press
SendInput(1, @ip, _SIZEOF( _winINPUT))
// Release the "L" key
ip.Input.ki.wVk := WORD ( Asc ( "L" ) )
ip.Input.ki.dwFlags := KEYEVENTF_KEYUP
SendInput(1, @ip, _SIZEOF( _winINPUT))
// Release the "Alt" key
ip.Input.ki.wVk := VK_MENU
ip.Input.ki.dwFlags := KEYEVENTF_KEYUP
IF SendInput(1, @ip, _SIZEOF( _winINPUT)) == 0
dwError := GetLastError()
MsgInfo ( NTrim ( dwError ) + crlf + ErrString ( dwError ) )
ENDIF
RETURN
---------------
regards
Karl-Heinz
Back to comp.lang.clipper.visual-objects | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
Sample for SendInput() ? Gerhard Bunzel <g.bunzel@domonet.de> - 2018-07-30 13:38 +0200
Re: Sample for SendInput() ? "Jamal" <nospam@example.com> - 2018-07-30 12:56 -0400
Re: Sample for SendInput() ? Gerhard Bunzel <g.bunzel@domonet.de> - 2018-07-31 11:57 +0200
Re: Sample for SendInput() ? Karl Wochele <kw@ecos-system.invalid> - 2018-07-31 07:33 +0200
Re: Sample for SendInput() ? Gerhard Bunzel <g.bunzel@domonet.de> - 2018-07-31 12:04 +0200
Re: Sample for SendInput() ? "Karl-Heinz" <invalid@invalid.invalid> - 2018-07-31 15:59 +0200
Re: Sample for SendInput() ? "Karl-Heinz" <invalid@invalid.invalid> - 2018-07-31 16:11 +0200
Re: Sample for SendInput() ? "Jamal" <noooospam@example.com> - 2018-07-31 15:00 -0400
Re: Sample for SendInput() ? Gerhard Bunzel <g.bunzel@domonet.de> - 2018-08-02 09:00 +0200
csiph-web