I'm wrinting a program that is Japanese on screen keyboard. When I use the ImmSetOpenStatus function to open IME for the focus windows as MS words... But it have been always failed. This is my code: - BOOL COnscreenKeyboardDlg::SetImeSwitchON()
-
{
-
m_fLog.initLogFile();
-
HWND wnd = ::GetForegroundWindow();
-
if(IsWindow(wnd))
-
{
-
if(!AttachThreadInput(GetWindowThreadProcessId(m_hWnd,NULL),GetWindowThreadProcessId(wnd,NULL),TRUE)){
-
m_fLog.putToLogFile( __FILE__, __LINE__, "AttachThreadInput failed\n");
-
}
-
::SetFocus(wnd);
-
char cWindowsName[MAX_PATH];
-
::GetWindowText(wnd,cWindowsName,MAX_PATH);
-
m_fLog.putToLogFile( __FILE__, __LINE__, cWindowsName);
-
HIMC hIMC = ImmGetContext(wnd);
-
if(!ImmGetOpenStatus(hIMC)){
-
if(!ImmSetOpenStatus(hIMC, TRUE)){
-
m_fLog.putToLogFile( __FILE__, __LINE__, "ImmSetOpenStatus failed\n");
-
}else{
-
m_fLog.putToLogFile( __FILE__, __LINE__, "ImmSetOpenStatus successed\n");
-
}
-
}
-
ImmReleaseContext( wnd, hIMC);
-
}else{
-
m_fLog.putToLogFile( __FILE__, __LINE__, "IsWindow(wnd) failed\n");
-
}
-
m_fLog.closeLogFile();
-
return 0;
-
}
-
I dont know where is wrong. please help me.
HIMC hIMC = ImmGetContext(wnd);
Does ImmGetContext return a non-null HIMC? You don't check.
10 5018
You are not checking any return values to se if things are working.
Hev you stepped though this with your debugger?
Hi weaknessforcats,
Thank you for your answer.
Yes I have debugged step by step and put it to the log file. It always failed at the ImmSetOpenStatus function.
HIMC hIMC = ImmGetContext(wnd);
Does ImmGetContext return a non-null HIMC? You don't check.
Hi weaknessforcats,
Thank you for your show. really, HIMC hIMC = ImmGetContext(wnd); was return NULL. But wnd is not NULL. why it return NULL? Can you teach me to correct it?
Are you using a version of Windows that supports this feature?
yes, I'm using Windows XP japanese version. It is supporting IME.
If your HWND is valid and you still get a NULL HIMC then you have a question for Microsoft.
Hi weaknessforcats,
Thank you for your help. I have solved it.
I'm glad to here that. But I am curious as to what the problem was. Can you share your solution?
Hi weaknessforcats,
The problem was my application can not switch IME mode of another application. So that ImmGetContext(wnd) always return null.
My solution is create global keyboard hook and implement the IME API in it. That's all.
Sign in to post your reply or Sign up for a free account.
Similar topics
by: Guyon Morée |
last post by:
what is the difference?
if I open a text file in binary (rb) mode, it doesn't matter... the read()
output is the same.
|
by: GRoll21 |
last post by:
I have a program here that asks the number of students surveyed. then
it will ask how many movies each student has watched. After thats been
collected it does functions to find the average, median,...
|
by: Edward Diener |
last post by:
I have some questions about the instructions for creating a mixed mode DLL
in the MSDN topic "Converting Managed Extensions for C++ Projects from Pure
Intermediate Language to Mixed Mode" in the...
|
by: Edward Diener |
last post by:
I received no answers about this the first time I posted, so I will try
again. My inability to decipher an MSDN topic may find others who have the
same inability and someone who can decipher and...
|
by: Mike |
last post by:
Hi,
I am having problems with my program, the problem is it will not put
the datagrid into edit mode.
The .aspx page has the following code in it : -
<asp:datagrid id="DataGrid2"...
|
by: Vincent |
last post by:
Dear all,
I have implemented a class to export the content of RichTextBox to
image in WYSISYG mode so that line breaks on the screen are the same as
exported.
C# Code:
public struct...
|
by: smith4894 |
last post by:
Hello all,
I'm working on writing my own streambuf classes (to use in my custom
ostream/isteam classes that will handle reading/writing data to a
mmap'd file).
When reading from the mmap...
|
by: Sathyaish |
last post by:
I have the following scenario:
Algorithm: 3DES
Cipher Mode: CBC
Key Size: 128-bit
Block Size: 64 bit
IV: 0x0000000000000000 (an eight byte array of zeros)
The results I get using .NET with...
|
by: shenanwei |
last post by:
DB2 V8.2 on AIX, type II index is created.
I see this from deadlock event monitor.
5) Deadlocked Connection ...
Participant no.: 2
Lock wait start time: 09/18/2006 23:04:09.911774
.........
|
by: Lucas |
last post by:
I need print a file in binary mode .
f = f.open('python.jpg','rb')
bytes = f.read()
f.close()
print(bytes)
I can't get any binary code.
|
by: Charles Arthur |
last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
|
by: ryjfgjl |
last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
|
by: emmanuelkatto |
last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud.
Please let me know.
Thanks!
Emmanuel
|
by: BarryA |
last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
|
by: nemocccc |
last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
|
by: Hystou |
last post by:
There are some requirements for setting up RAID:
1. The motherboard and BIOS support RAID configuration.
2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
|
by: Hystou |
last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
|
by: Oralloy |
last post by:
Hello folks,
I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>".
The problem is that using the GNU compilers,...
|
by: jinu1996 |
last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
| |