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


------------------------ Yahoo! Groups Sponsor --------------------~--> 
<font face=arial size=-1><a 
href="http://us.ard.yahoo.com/SIG=12hlb75tm/M=362329.6886308.7839368.1510227/D=groups/S=1705115362:TM/Y=YAHOO/EXP=1124216326/A=2894321/R=0/SIG=11dvsfulr/*http://youthnoise.com/page.php?page_id=1992
">Fair play? Video games influencing politics. Click and talk back!</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/
 


Reply via email to