Skip to content

Instantly share code, notes, and snippets.

@sys9kdr
Created October 4, 2024 22:06
Show Gist options
  • Save sys9kdr/60a0943fd0e2e7768da3667e229b6976 to your computer and use it in GitHub Desktop.
Save sys9kdr/60a0943fd0e2e7768da3667e229b6976 to your computer and use it in GitHub Desktop.
#include <stdio.h>
#include <windows.h>
#define IME_CONTROL 0x283
#define IMC_GETOPENSTATUS 0x5
#define IMC_SETOPENSTATUS 0x6
int main(int argc, char** argv) {
HWND fg = GetForegroundWindow();
if(!fg) return 0;
HWND ime = ImmGetDefaultIMEWnd(fg);
if(!ime) return 0;
LPARAM status;
if(argc < 2) {
status = SendMessage(ime, WM_IME_CONTROL, IMC_GETOPENSTATUS, 0);
} else {
status = (LPARAM)atol(argv[1]);
SendMessage(ime, IME_CONTROL, IMC_SETOPENSTATUS, status);
}
printf("%lld", status);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment