On Mon, 2007-05-21 at 23:32 -0700, Andreas Raab wrote:
Have you tried handling WM_UNICHAR instead of tricking the VM into Unicode mode? If you do what you did above some other messages come in with Unicode args too and while this may be desirable at some point I'm not sure if we want this right away. For the time being I'd feel safer if we would handle WM_UNICHAR explicitly. Also, WM_UNICHAR uses (according to the docs) UTF-32 instead of UTF-16 as in your code. This might come in handy at some point.
OK...i've been trying to use the WM_UNICHAR solution but i haven't managed to achieve it yet... Does the window have to be registered to receive Unicode with
+SetWindowLongW(stWindow,GWL_WNDPROC,GetWindowLong(stWindow,GWL_WNDPROC)); +SetWindowLongW(consoleWindow,GWL_WNDPROC,GetWindowLong(consoleWindow,GWL_WNDPROC));
again in this case? ... i suppose not. What i did is to add the following to the relevant switch statement
switch(msg->message) { case WM_KEYDOWN: case WM_SYSKEYDOWN: if(virtCode) keyCode = virtCode; ................................. case WM_UNICHAR: // HERE printf("Oops! Unicode char!\n"); break; case WM_CHAR: case WM_SYSCHAR: /* Note: VK_RETURN is recorded as virtual key ONLY */ if(keyCode == 13) return 1; pressCode = EventKeyChar; break;
Also, i defined WM_UNICHAR with
#ifndef WM_UNICHAR #define WM_UNICHAR 0x109 #endif
I also defined those as a workaround while googling
#define UNICODE #define _UNICODE
But, printf("Oops! Unicode char!\n");
is never invoked...
Has anyone implemented this solution??? Some guidelines would be most welcome...
Sorry if this is a simple C-related thing... i'm not a very good C programmer...but i want to become one! :-)
Thanks in advance...
Christos.