|
- HWND hWnd = GetForegroundWindow();
- ASSERT(IsWindow(hWnd))
- // Get Target Thread ID and Attach Thread Input
- DWORD ProcID;
- DWORD ThreadID = GetWindowThreadProcessId(hWnd, &ProcID);
- AttachThreadInput(GetCurrentThreadId(), ThreadID, TRUE);
- // Get Target Window
- HWND hWndFocus = GetFocus();
- // Post Input Messages
- ASSERT(IsWindow(hWndFocus));
- // Change Input Language
- PostMessage(hWndFocus, WM_INPUTLANGCHANGEREQUEST, (WPARAM)TRUE, (LPARAM)g_hklRPC); // Use Language ID 0x0804(Chinese PRC)
- // Detach Thread Input
- AttachThreadInput(GetCurrentThreadId(), ThreadID, FALSE);
复制代码 |
|