Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.clipper.visual-objects > #5308 > unrolled thread
| Started by | "Arne Ortlinghaus" <Arne.Ortlinghaus@acs.it> |
|---|---|
| First post | 2013-05-30 11:39 +0200 |
| Last post | 2013-06-04 18:07 +0200 |
| Articles | 7 — 4 participants |
Back to article view | Back to comp.lang.clipper.visual-objects
SendInput - Calculator and putting numbers "Arne Ortlinghaus" <Arne.Ortlinghaus@acs.it> - 2013-05-30 11:39 +0200
Re: SendInput - Calculator and putting numbers dlzc <dlzc1@cox.net> - 2013-05-30 07:10 -0700
Re: SendInput - Calculator and putting numbers "Jamal" <jamal@examples.net> - 2013-05-31 12:57 -0400
Re: SendInput - Calculator and putting numbers "Arne Ortlinghaus" <Arne.Ortlinghaus@acs.it> - 2013-06-03 12:10 +0200
Re: SendInput - Calculator and putting numbers "Gerhard Bunzel" <g.bunzel@domonet.de> - 2013-06-03 13:21 +0200
Re: SendInput - Calculator and putting numbers "Gerhard Bunzel" <g.bunzel@domonet.de> - 2013-06-03 14:01 +0200
Re: SendInput - Calculator and putting numbers "Arne Ortlinghaus" <Arne.Ortlinghaus@acs.it> - 2013-06-04 18:07 +0200
| From | "Arne Ortlinghaus" <Arne.Ortlinghaus@acs.it> |
|---|---|
| Date | 2013-05-30 11:39 +0200 |
| Subject | SendInput - Calculator and putting numbers |
| Message-ID | <ko76fn$d87$1@dont-email.me> |
Has someone already used the WinAPI function Sendinput? I have to call the windows calculator from my program and send a number. With wm_settext and wm_paste it is not possible to put a number. Now I want to simulate key strokes. Arne Ortlinghaus ACS Data Systems
[toc] | [next] | [standalone]
| From | dlzc <dlzc1@cox.net> |
|---|---|
| Date | 2013-05-30 07:10 -0700 |
| Message-ID | <0bb986c1-41da-4552-b629-5f17d7bcee16@googlegroups.com> |
| In reply to | #5308 |
Dear Arne Ortlinghaus: On Thursday, May 30, 2013 2:39:08 AM UTC-7, Arne Ortlinghaus wrote: ... > I have to call the windows calculator from my > program and send a number. With wm_settext and > wm_paste it is not possible to put a number. Now > I want to simulate key strokes. Probably enough searchable stuff in this link to get you going. His example code is C++ for pushing keystrokes to Windows Calculator... so you'd look for similar API function names. You will probably have to convert your number to text, and send that. David A. Smith
[toc] | [prev] | [next] | [standalone]
| From | "Jamal" <jamal@examples.net> |
|---|---|
| Date | 2013-05-31 12:57 -0400 |
| Message-ID | <koakq5$dbd$1@speranza.aioe.org> |
| In reply to | #5308 |
The following terminal app sample works with PostMessage( ) and WM_KEYUP.
This may be alternate way.
FUNCTION Start()
LOCAL h AS PTR
// run MS Calculator first
h := FindWindow(NULL_PTR, String2Psz("Calculator"))
PostMessage(h, WM_KEYUP, 0x69, 0L ) // NUMPAD 9
PostMessage(h, WM_KEYUP, 0x6D, 0L ) // NUMPAD -
PostMessage(h, WM_KEYUP, 0x65, 0L ) // NUMPAD 5
WAIT
PostMessage(h, WM_KEYUP, 0x13, 0L ) // NUMPAD ENTER
WAIT
RETURN NIL
Jamal
"Arne Ortlinghaus" wrote in message news:ko76fn$d87$1@dont-email.me...
Has someone already used the WinAPI function Sendinput?
I have to call the windows calculator from my program and send a number.
With wm_settext and wm_paste it is not possible to put a number. Now I want
to simulate key strokes.
Arne Ortlinghaus
ACS Data Systems
[toc] | [prev] | [next] | [standalone]
| From | "Arne Ortlinghaus" <Arne.Ortlinghaus@acs.it> |
|---|---|
| Date | 2013-06-03 12:10 +0200 |
| Message-ID | <kohpq2$s7h$1@dont-email.me> |
| In reply to | #5314 |
Hi Jamal,
thank you. Indeed you solution has helped me saving some time.
It works good except for the enter key. On my Win 7 machine it is ignored,
also other characters like Return 0xD or 0xA. I would need it for
implementing sending negative numbers to the calculator.
Arne
"Jamal" <jamal@examples.net> schrieb im Newsbeitrag
news:koakq5$dbd$1@speranza.aioe.org...
> The following terminal app sample works with PostMessage( ) and WM_KEYUP.
> This may be alternate way.
>
> FUNCTION Start()
>
> LOCAL h AS PTR
>
> // run MS Calculator first
>
> h := FindWindow(NULL_PTR, String2Psz("Calculator"))
>
>
> PostMessage(h, WM_KEYUP, 0x69, 0L ) // NUMPAD 9
>
> PostMessage(h, WM_KEYUP, 0x6D, 0L ) // NUMPAD -
>
> PostMessage(h, WM_KEYUP, 0x65, 0L ) // NUMPAD 5
>
> WAIT
>
> PostMessage(h, WM_KEYUP, 0x13, 0L ) // NUMPAD ENTER
>
> WAIT
>
> RETURN NIL
>
> Jamal
>
> "Arne Ortlinghaus" wrote in message news:ko76fn$d87$1@dont-email.me...
>
> Has someone already used the WinAPI function Sendinput?
>
> I have to call the windows calculator from my program and send a number.
> With wm_settext and wm_paste it is not possible to put a number. Now I
> want
> to simulate key strokes.
>
> Arne Ortlinghaus
> ACS Data Systems
[toc] | [prev] | [next] | [standalone]
| From | "Gerhard Bunzel" <g.bunzel@domonet.de> |
|---|---|
| Date | 2013-06-03 13:21 +0200 |
| Message-ID | <kohu8i$bqv$1@news.m-online.net> |
| In reply to | #5308 |
Arne, here you will find a vb.net-sample to get the Windows Calc value with Win32-Standard-API. With SetWindowText() it should be possible, to send your number. http://social.msdn.microsoft.com/Forums/en-US/isvvba/thread/e9b2c76c-c96e-46a8-b5cc-d26798e831ae/ http://msdn.microsoft.com/en-us/library/windows/desktop/ms633546(v=vs.85).aspx hth Gerhard "Arne Ortlinghaus" <Arne.Ortlinghaus@acs.it> schrieb im Newsbeitrag news:ko76fn$d87$1@dont-email.me... > Has someone already used the WinAPI function Sendinput? > > I have to call the windows calculator from my program and send a number. > With wm_settext and wm_paste it is not possible to put a number. Now I > want to simulate key strokes. > > Arne Ortlinghaus > ACS Data Systems
[toc] | [prev] | [next] | [standalone]
| From | "Gerhard Bunzel" <g.bunzel@domonet.de> |
|---|---|
| Date | 2013-06-03 14:01 +0200 |
| Message-ID | <koi0is$4e2$1@news.m-online.net> |
| In reply to | #5317 |
Hi Arne,
have done a smal test with a german windows:
Set text in in calculator:
LOCAL hWnd AS PTR
LOCAL cText AS STRING
hWnd := FindWindow(String2Psz("SciCalc"), String2Psz("Rechner"))
hWnd := FindWindowEx(hwnd, 0, String2Psz("Edit"), NULL_PSZ)
cText := "1234,789"
iRet := SendMessage(hwnd, WM_SETTEXT, 0, LONG(_CAST, String2Psz(cText)))
Get text from calculator:
LOCAL hWnd AS PTR
LOCAL cText AS STRING
LOCAL iLen AS LONG
LOCAL iRet AS LONG
LOCAL pBuff AS PTR
hWnd := FindWindow(String2Psz("SciCalc"), String2Psz("Rechner"))
hWnd := FindWindowEx(hwnd, 0, String2Psz("Edit"), NULL_PSZ)
// First, get the text lenght.
iLen := SendMessage( hWnd, WM_GETTEXTLENGTH, 0, 0L )
IF iLen > 0
pBuff := MemAlloc( iLen + 1 )
IF pBuff <> NULL_PTR
iRet := SendMessage(hWnd, WM_GETTEXT, DWORD(_CAST, iLen), LONG(_CAST,
pBuff))
IF iRet > 0
cText := Psz2String( pBuff )
ENDIF
MemFree( pBuff )
ENDIF
ENDIF
HTH
Gerhard
"Gerhard Bunzel" <g.bunzel@domonet.de> schrieb im Newsbeitrag
news:kohu8i$bqv$1@news.m-online.net...
> Arne,
>
> here you will find a vb.net-sample to get the Windows Calc value with
> Win32-Standard-API.
> With SetWindowText() it should be possible, to send your number.
>
> http://social.msdn.microsoft.com/Forums/en-US/isvvba/thread/e9b2c76c-c96e-46a8-b5cc-d26798e831ae/
>
> http://msdn.microsoft.com/en-us/library/windows/desktop/ms633546(v=vs.85).aspx
>
>
> hth
>
> Gerhard
>
>
> "Arne Ortlinghaus" <Arne.Ortlinghaus@acs.it> schrieb im Newsbeitrag
> news:ko76fn$d87$1@dont-email.me...
>> Has someone already used the WinAPI function Sendinput?
>>
>> I have to call the windows calculator from my program and send a number.
>> With wm_settext and wm_paste it is not possible to put a number. Now I
>> want to simulate key strokes.
>>
>> Arne Ortlinghaus
>> ACS Data Systems
>
>
[toc] | [prev] | [next] | [standalone]
| From | "Arne Ortlinghaus" <Arne.Ortlinghaus@acs.it> |
|---|---|
| Date | 2013-06-04 18:07 +0200 |
| Message-ID | <kol33g$p13$1@dont-email.me> |
| In reply to | #5318 |
Hi Gerhard,
very nice.
I tried wm_settext with the main window of the calculator and got only a
different caption.
The
hWnd := FindWindowEx(hwnd, 0, String2Psz("Edit"), NULL_PSZ)
is a nice trick.
Thank you
Arne
"Gerhard Bunzel" <g.bunzel@domonet.de> schrieb im Newsbeitrag
news:koi0is$4e2$1@news.m-online.net...
> Hi Arne,
>
> have done a smal test with a german windows:
>
> Set text in in calculator:
> LOCAL hWnd AS PTR
> LOCAL cText AS STRING
>
> hWnd := FindWindow(String2Psz("SciCalc"), String2Psz("Rechner"))
> hWnd := FindWindowEx(hwnd, 0, String2Psz("Edit"), NULL_PSZ)
>
> cText := "1234,789"
>
> iRet := SendMessage(hwnd, WM_SETTEXT, 0, LONG(_CAST, String2Psz(cText)))
>
>
> Get text from calculator:
> LOCAL hWnd AS PTR
> LOCAL cText AS STRING
> LOCAL iLen AS LONG
> LOCAL iRet AS LONG
> LOCAL pBuff AS PTR
>
> hWnd := FindWindow(String2Psz("SciCalc"), String2Psz("Rechner"))
> hWnd := FindWindowEx(hwnd, 0, String2Psz("Edit"), NULL_PSZ)
>
> // First, get the text lenght.
> iLen := SendMessage( hWnd, WM_GETTEXTLENGTH, 0, 0L )
>
> IF iLen > 0
> pBuff := MemAlloc( iLen + 1 )
> IF pBuff <> NULL_PTR
> iRet := SendMessage(hWnd, WM_GETTEXT, DWORD(_CAST, iLen), LONG(_CAST,
> pBuff))
> IF iRet > 0
> cText := Psz2String( pBuff )
> ENDIF
> MemFree( pBuff )
> ENDIF
> ENDIF
>
>
> HTH
>
> Gerhard
>
>
>
> "Gerhard Bunzel" <g.bunzel@domonet.de> schrieb im Newsbeitrag
> news:kohu8i$bqv$1@news.m-online.net...
>> Arne,
>>
>> here you will find a vb.net-sample to get the Windows Calc value with
>> Win32-Standard-API.
>> With SetWindowText() it should be possible, to send your number.
>>
>> http://social.msdn.microsoft.com/Forums/en-US/isvvba/thread/e9b2c76c-c96e-46a8-b5cc-d26798e831ae/
>>
>> http://msdn.microsoft.com/en-us/library/windows/desktop/ms633546(v=vs.85).aspx
>>
>>
>> hth
>>
>> Gerhard
>>
>>
>> "Arne Ortlinghaus" <Arne.Ortlinghaus@acs.it> schrieb im Newsbeitrag
>> news:ko76fn$d87$1@dont-email.me...
>>> Has someone already used the WinAPI function Sendinput?
>>>
>>> I have to call the windows calculator from my program and send a number.
>>> With wm_settext and wm_paste it is not possible to put a number. Now I
>>> want to simulate key strokes.
>>>
>>> Arne Ortlinghaus
>>> ACS Data Systems
>>
>>
>
>
[toc] | [prev] | [standalone]
Back to top | Article view | comp.lang.clipper.visual-objects
csiph-web