60436548 avatar image
0 Votes"
60436548 asked RLWA32-6355 commented

Microsoft IME is not activated after new desktop created by API CreateDesktop?

I created a new desktop for some user-registration program which requires user text info input via edit box.

The problem is:
Microsoft IME works well in the default desktop ( Named as DeskA).
But in the new created desktop (Named as DeskN), microsoft IME CAN NOT be activated in any edit control, even in notepad program.

The desktop creation code is as following:

 HDESK hCurrentDesk = GetThreadDesktop(GetCurrentThreadId());
 HDESK hVirtualOutSourceDesk = CreateDesktop(
 TCHAR explorer_path[MAX_PATH];
 STARTUPINFO startup_info = { 0 };
 ExpandEnvironmentStrings(L"%windir%\\explorer.exe", explorer_path, MAX_PATH - 1);
 startup_info.cb = sizeof(startup_info);
 startup_info.lpDesktop = const_cast<TCHAR*>(szSecDesktopName.c_str());
 PROCESS_INFORMATION process_info = { 0 };
 //We need to create an explorer.exe in the context of the new desktop for start menu, etc
 CreateProcess(explorer_path, NULL, NULL, NULL, FALSE, 0, NULL, NULL, &startup_info, &process_info);

I guess there may be some permission issue but not clear about this.
Any suggestions?

· 2
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

The Sysinternals Desktops application creates multiple desktops that each use explorer. I suggest using that as a test harness to see if the IME problem is reproduced.

0 Votes 0 ·

The sysinternals desktop tool has the same problem.

0 Votes 0 ·

1 Answer

XiaopoYang-MSFT avatar image
0 Votes"
XiaopoYang-MSFT answered RLWA32-6355 commented

According to Desktops,

The desktops associated with the interactive window station, Winsta0, can be made to display a user interface and receive user input, but only one of these desktops at a time is active. This active desktop, also known as the input desktop, is the one that is currently visible to the user and that receives user input. Applications can use the OpenInputDesktop function to get a handle to the input desktop. Applications that have the required access can use the SwitchDesktop function to specify a different input desktop.

· 3
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

Actually, our new created desktop could get user input. Eg. input some english characters.
But Microsoft IME(Text Service Framework) is not actived in any edit control.
Other IME such as QQ/Google pinyin (traditional IME framework) is ok.

More clear, I have two exes EXEA (run in default desktop 'DA') and EXEB (run in newly created desktop 'DB').

EXEA run in default deskotp and
1. create desktop DB
2. createProcess EXEB with STARTUPINFO.lpDesktop = 'DB'
3. switch to desktop DB

0 Votes 0 ·

Perhaps you can SwitchDesktop(DB) to see whether Microsoft IME works well in the desktop DB or not.

0 Votes 0 ·

ctfmon.exe is probably running on DA, the default desktop. So I'll guess that it would not be available to applications running on desktop DB.

0 Votes 0 ·