Sign in to follow this  
Fish HF

sending WM_CHARs

Recommended Posts

I wrote a little program that is like IME that lets me input some chinese words, now i need to get the characters to sent to the windows. I'm using PostMessage to send the wonderful WM_CHAR messages to the window handle that i got from GetForegroundWindow before my window got focus, but it won't work because the window handle i got from GetForegroundWindow is not a child window that has the keyboard focus....so sending the message to the parent window won't work It does work when it's sent to a simple window with a editbox written in vb.... Any advices are welcome :) thanks

Share this post


Link to post
Share on other sites
use send message instead. send message calls the winproc directly thus bypassing the message que. I think the que might be perventing the message to go through. also, the program you're sending the message to might have some specific code that requires a keyboard focus message to work correctly. just somthing to think about. send message should work.

Tim

Share this post


Link to post
Share on other sites
No, it seems it doesnt....heres the code:

HWND t=GetForegroundWindow();
if(t!=hwndme)
{
target=t;
SendMessage(target,WM_CHAR,'a',0);
}


maybe the message didn't get passed to the windows's child windows or editboxes?



function GetFocusWindow( h: HWnd ): hWnd; in http://www.tt.rim.or.jp/~muramatu/delphi/SendKey/SENDKEY.PAS seems to be what i'm looking for.....

[Edited by - Fish HF on October 22, 2005 4:51:33 AM]

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this