Home » U++ Library support » U++ Libraries and TheIDE: i18n, Unicode and Internationalization » Unicode input in Windows (not IME)
Unicode input in Windows (not IME) [message #16024] |
Fri, 23 May 2008 10:47  |
scorpionfirevn
Messages: 5 Registered: November 2007
|
Promising Member |

|
|
Hi,
In linux unicode input for U++ works well, but in windows i cannot input with unicode, because i use a vietnamese input soft. This soft use keyboard hook API to input vietnamese characters.
If you want to input unicode like that way you can patch some code like here:
File: Win32Wnd.cpp, Function: sProcessMSG(MSG& msg)
Old code:
Quote: | DispatchMessage(&msg);
|
New code:
Quote: |
if(IsWindowUnicode(msg.hwnd))
DispatchMessageW(&msg);
else
DispatchMessage(&msg);
|
File: Win32Wnd.cpp, Function: sProcessMSG(MSG& msg)
Old code:
Quote: | if(PeekMessage(&msg, NULL, 0, 0, PM_REMOVE))
{
//.... something here
}
|
New Code:
Quote: |
bool succeed = IsWindowUnicode(msg.hwnd)==true?PeekMessageW(&msg, NULL, 0, 0, PM_REMOVE):PeekMessage(&msg, NULL, 0, 0, PM_REMOVE);
if(succeed) {
//.... something here
}
|
It is like this picture:
-
Attachment: desk.JPG
(Size: 224.74KB, Downloaded 965 times)
|
|
|
Re: Unicode input in Windows (not IME) [message #16185 is a reply to message #16024] |
Sat, 31 May 2008 18:01  |
 |
mirek
Messages: 14255 Registered: November 2005
|
Ultimate Member |
|
|
scorpionfirevn wrote on Fri, 23 May 2008 04:47 | Hi,
In linux unicode input for U++ works well, but in windows i cannot input with unicode, because i use a vietnamese input soft. This soft use keyboard hook API to input vietnamese characters.
If you want to input unicode like that way you can patch some code like here:
File: Win32Wnd.cpp, Function: sProcessMSG(MSG& msg)
Old code:
Quote: | DispatchMessage(&msg);
|
New code:
Quote: |
if(IsWindowUnicode(msg.hwnd))
DispatchMessageW(&msg);
else
DispatchMessage(&msg);
|
File: Win32Wnd.cpp, Function: sProcessMSG(MSG& msg)
Old code:
Quote: | if(PeekMessage(&msg, NULL, 0, 0, PM_REMOVE))
{
//.... something here
}
|
New Code:
Quote: |
bool succeed = IsWindowUnicode(msg.hwnd)==true?PeekMessageW(&msg, NULL, 0, 0, PM_REMOVE):PeekMessage(&msg, NULL, 0, 0, PM_REMOVE);
if(succeed) {
//.... something here
}
|
It is like this picture:

|
Thanks. I am afraid the second change does not make sense (you do not know whether window is unicode when calling PeekMessage), so I have rather replaced all PeekMessage with
static bool PeekMsg(MSG& msg)
{
if(!PeekMessage(&msg, NULL, 0, 0, PM_NOREMOVE)) return false;
return IsWindowUnicode(msg.hwnd) ? PeekMessageW(&msg, NULL, 0, 0, PM_REMOVE)
: PeekMessage(&msg, NULL, 0, 0, PM_REMOVE);
}
Mirek
|
|
|
Goto Forum:
Current Time: Fri Apr 25 11:57:00 CEST 2025
Total time taken to generate the page: 0.00476 seconds
|