// gcc -static -mwindows ImmConfigureIME_test.c -limm32 -luser32 -lcomdlg32 -lcomctl32 #define UNICODE 1 #include #include #include LRESULT CALLBACK WndProc(HWND hWnd, UINT msg, WPARAM wp, LPARAM lp) { switch (msg) { case WM_CREATE: break; case WM_LBUTTONUP: { int ret; REGISTERWORD regword; regword.lpReading=TEXT("よみ") ; regword.lpWord =TEXT("読み方") ; // ret=ImmConfigureIME(GetKeyboardLayout(0),hWnd, IME_CONFIG_GENERAL, NULL); ret=ImmConfigureIME(GetKeyboardLayout(0),hWnd, IME_CONFIG_REGISTERWORD, ®word); printf("ret= %d\n",ret); } break ; case WM_CLOSE: DestroyWindow(hWnd); break; case WM_DESTROY: PostQuitMessage(0); break; default: return (DefWindowProc(hWnd, msg, wp, lp)); } return 0L; } BOOL InitApp(HINSTANCE hInst, PTSTR szClassName) { WNDCLASS wc; wc.style = CS_HREDRAW | CS_VREDRAW; wc.lpfnWndProc = WndProc; wc.cbClsExtra = 0; wc.cbWndExtra = 0; wc.hInstance = hInst; wc.hIcon = LoadIcon(NULL, IDI_APPLICATION); wc.hCursor = LoadCursor(NULL, IDC_ARROW); wc.hbrBackground = GetStockObject(WHITE_BRUSH); wc.lpszMenuName = NULL ; wc.lpszClassName = szClassName; return (RegisterClass(&wc)); } BOOL InitInstance(HINSTANCE hInst, PTSTR szClassName, int nCmdShow) { HWND hWnd; HMENU hMenu; hWnd = CreateWindow(szClassName, NULL, WS_CAPTION | WS_CLIPSIBLINGS | WS_CLIPCHILDREN | WS_OVERLAPPEDWINDOW | WS_VISIBLE, CW_USEDEFAULT, CW_USEDEFAULT, 640, 480, NULL, NULL, hInst, NULL); if (!hWnd) return FALSE; ShowWindow(hWnd, SW_SHOW); UpdateWindow(hWnd); return TRUE; } int main() { MSG msg; PTSTR szClassName ; HINSTANCE hInstance; szClassName=TEXT("ImmConfigureIME_test") ; hInstance = GetModuleHandle(NULL); if (!InitApp(hInstance, szClassName)){ return FALSE; } if (!InitInstance(hInstance, szClassName, 0)) { return FALSE; } while (GetMessage(&msg, NULL, 0, 0)) { TranslateMessage(&msg); DispatchMessage(&msg); } return msg.wParam; }