Overview
Examples
Screenshots
Comparisons
Applications
Download
Documentation
Tutorials
Bazaar
Status & Roadmap
FAQ
Authors & License
Forums
Funding Ultimate++
Search on this site
Search in forums












SourceForge.net Logo
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 Go to next message
scorpionfirevn is currently offline  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:
index.php?t=getfile&id=1217&private=0
  • Attachment: desk.JPG
    (Size: 224.74KB, Downloaded 832 times)
Re: Unicode input in Windows (not IME) [message #16185 is a reply to message #16024] Sat, 31 May 2008 18:01 Go to previous message
mirek is currently offline  mirek
Messages: 13975
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:
index.php?t=getfile&id=1217&private=0

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
Previous Topic: CJK characters can be higlighted as keywords
Next Topic: CJK source code comment
Goto Forum:
  


Current Time: Fri Apr 19 23:11:58 CEST 2024

Total time taken to generate the page: 0.02985 seconds