Hi Rob
I tried PostMessage but it still doesnt work, I had already tried WM_KEYUP
and WM_KEYDOWN with SendMessage, I tried them also with PostMessage but without
success... can you give me a brief example please, you already have the
parameters I am using in my first post.
Thank you
Vahan
-----Original Message-----
From: [email protected] [mailto:[EMAIL PROTECTED] Behalf Of Rob Kennedy
Sent: Tuesday, August 16, 2005 6:19 PM
To: [email protected]
Subject: Re: [delphi-en] SendMessage method
Vahan Yoghoudjian wrote:
> I have designed a virtual keyboard for my application where the user
> can launch a form anywhere within the application and write into the
> focused control.
>
> I have created my own keyboard buttons and used them on the keyboard
> form. Those components have a property called value. Every time a key
> is pressed I do the following
>
> SendMessage(TheActiveControl.Handle,WM_CHAR,KeyValue,0)
>
> I have the button backspace which key value is initialized like:
> KeyBackspace.KeyValue := VK_BACK
>
> When I click on the backspace key, instead of erasing the last
> character written I have weird characters written on my controls...
> any ideas what am I doing wrong here?
You're not sending the right messages. You're making a keyboard, so you
need to send *key* messages, not *character* messages. Whether a key
corresponds to a character is determined by a number of factors.
Send wm_KeyDown and wm_KeyUp. When the application receives those
messages, it passes them to the TranslateMessage API function. That
function looks at the current message and, depending on the keyboard
state of the current thread, generates a wm_Char message for itself.
For TranslateMessage to work, you need to use PostMessage, not
SendMessage. Sent messages go directly to the destination window. They
don't pass through the message queue, so they don't go through the
thread's queue-processing code, which is where TranslateMessage gets called.
--
Rob
-----------------------------------------------------
Home page: http://groups.yahoo.com/group/delphi-en/
To unsubscribe: [EMAIL PROTECTED]
--------------------------------------------------------------------------------
YAHOO! GROUPS LINKS
a.. Visit your group "delphi-en" on the web.
b.. To unsubscribe from this group, send an email to:
[EMAIL PROTECTED]
c.. Your use of Yahoo! Groups is subject to the Yahoo! Terms of Service.
--------------------------------------------------------------------------------
[Non-text portions of this message have been removed]
------------------------ Yahoo! Groups Sponsor --------------------~-->
<font face=arial size=-1><a
href="http://us.ard.yahoo.com/SIG=12h3qcr6m/M=362131.6882499.7825260.1510227/D=groups/S=1705115362:TM/Y=YAHOO/EXP=1124268148/A=2889191/R=0/SIG=10r90krvo/*http://www.thebeehive.org
">Get Bzzzy! (real tools to help you find a job) Welcome to the Sweet Life
- brought to you by One Economy</a>.</font>
--------------------------------------------------------------------~->
-----------------------------------------------------
Home page: http://groups.yahoo.com/group/delphi-en/
To unsubscribe: [EMAIL PROTECTED]
Yahoo! Groups Links
<*> To visit your group on the web, go to:
http://groups.yahoo.com/group/delphi-en/
<*> To unsubscribe from this group, send an email to:
[EMAIL PROTECTED]
<*> Your use of Yahoo! Groups is subject to:
http://docs.yahoo.com/info/terms/