Try this procedure
procedure TForm1.PushKey(const aAsciiKey: integer);
var
vWordKey: Word;
begin
SendMessage(self.Handle, WM_CHAR, aAsciiKey, 0);
vWordKey := aAsciiKey;
Keyup(vWordKey, []);
end;
I have inherited TEdit and use this procedure in the descendant class,
on my virtual keyboard whenever I click on a button I call this procedure:
myEdit.PushKey(ord(Key)). This way my keyboard acts as if I really pressed a
key on the physical keyboard.
If you want to do things ideally you have to inherit TButton class, in
this class you will add 2 properties, one that will contain the lowercase
character of the button and the other the uppercase, and when this button is
clicked, according to the shift state you will pass the ord of key to the
procedure shown above
Just one warning: In the SendMessage I use Self.Handle, since I have my
own inherited TEdit class and I use a different concept of yours, as for you
you have to find the focused control on the form and use the Handle of that
control. (I don't know how to find the focused control on the form I have
never tried it)
Hope this helps
Vahan
-----Original Message-----
From: Akram Mustafa [mailto:[EMAIL PROTECTED]
Sent: Thursday, March 24, 2005 9:50 AM
To: [email protected]
Subject: RE: [delphi-en] Keyboard
i want to design my own virtual keyboard
do you know how to send a key message ?
Vahan Yoghoudjian <[EMAIL PROTECTED]> wrote:
Actually I'm designing my own virtual keyboard right now... but I think
I'll be using it differently... have you designed a virtual keyboard or you
want to use windows virtual keyboard?
-----Original Message-----
From: akram_delphi [mailto:[EMAIL PROTECTED]
Sent: Wednesday, March 23, 2005 1:39 PM
To: [email protected]
Subject: [delphi-en] Keyboard
Hi
I want my application to work like osk.exe the one exist in Windows
XP
i want if I clicked on button called 'T' a T letter type in
whereever the cursor is
if clicked 'CTRL' button and then clicked 'S' a CTRL + S keyboard
message sent to the system
any help?
any examples?
thanks
-----------------------------------------------------
Home page: http://groups.yahoo.com/group/delphi-en/
To unsubscribe: [EMAIL PROTECTED]
Yahoo! Groups Sponsor
ADVERTISEMENT
----------------------------------------------------------------------------
----
Yahoo! Groups Links
a.. To visit your group on the web, go to:
http://groups.yahoo.com/group/delphi-en/
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]
-----------------------------------------------------
Home page: http://groups.yahoo.com/group/delphi-en/
To unsubscribe: [EMAIL PROTECTED]
Yahoo! Groups SponsorADVERTISEMENT
---------------------------------
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 the Yahoo! Terms of Service.
---------------------------------
Do you Yahoo!?
Yahoo! Small Business - Try our new resources site!
[Non-text portions of this message have been removed]
-----------------------------------------------------
Home page: http://groups.yahoo.com/group/delphi-en/
To unsubscribe: [EMAIL PROTECTED]
Yahoo! Groups Sponsor
ADVERTISEMENT
----------------------------------------------------------------------------
----
Yahoo! Groups Links
a.. To visit your group on the web, go to:
http://groups.yahoo.com/group/delphi-en/
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]
-----------------------------------------------------
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/