{"id":15046218,"url":"https://github.com/ryancheung/imesharp","last_synced_at":"2025-06-18T16:34:14.085Z","repository":{"id":37640867,"uuid":"286014703","full_name":"ryancheung/ImeSharp","owner":"ryancheung","description":"C# wrapper for Windows IME APIs","archived":false,"fork":false,"pushed_at":"2025-06-16T05:05:50.000Z","size":239,"stargazers_count":80,"open_issues_count":4,"forks_count":14,"subscribers_count":5,"default_branch":"master","last_synced_at":"2025-06-16T05:16:08.039Z","etag":null,"topics":["ime","imm32","tsf","uwp","windows","winforms","wrapper"],"latest_commit_sha":null,"homepage":"","language":"C#","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/ryancheung.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE.txt","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2020-08-08T09:40:35.000Z","updated_at":"2025-06-16T05:05:54.000Z","dependencies_parsed_at":"2024-06-21T16:52:16.107Z","dependency_job_id":"3e0c1cb9-2f16-45cd-acc0-16a2e018231b","html_url":"https://github.com/ryancheung/ImeSharp","commit_stats":null,"previous_names":[],"tags_count":13,"template":false,"template_full_name":null,"purl":"pkg:github/ryancheung/ImeSharp","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ryancheung%2FImeSharp","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ryancheung%2FImeSharp/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ryancheung%2FImeSharp/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ryancheung%2FImeSharp/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/ryancheung","download_url":"https://codeload.github.com/ryancheung/ImeSharp/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ryancheung%2FImeSharp/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":260589722,"owners_count":23032941,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["ime","imm32","tsf","uwp","windows","winforms","wrapper"],"created_at":"2024-09-24T20:52:52.262Z","updated_at":"2025-06-18T16:34:14.035Z","avatar_url":"https://github.com/ryancheung.png","language":"C#","funding_links":[],"categories":[],"sub_categories":[],"readme":"# IME Sharp\n[![Nuget](https://img.shields.io/nuget/v/ImeSharp)](https://www.nuget.org/packages/ImeSharp/)\n\nA C# wrapper for Windows IME APIs. Its goal is to support both IMM32 and TSF.\n\nTSF Implementation is based on WPF core.\n\n## Packages\n\n`dotnet add package ImeSharp`\n\nNote ImeSharp.NetStandard package is deprecated, use ImeSharp instead.\n\n## Usage\n\n### Initialization\n\nCall `InputMethod.Initialize` to initialize the input method with a window handle, e.g. `InputMethod.Initialize(someWindowHandle)`.\n\nIf you don't want the OS Candidate Window, do `InputMethod.Initialize(someWindowHandle, false)`.\n\n### Custom message pumping\n\nIf we don't enable custom windows message pumping. Use TSF in WinForms would have a issue: Frame will randomly stuck when composing with IME.\nThis is because TSF disables Application.Idle event when it's busy. Enables custom message pumping fix this.\n\nIn WinForms, we add message pumping at the end line in `Application.Idle` handler, e.g.:\n\n```c#\nprivate void Application_Idle(object sender, EventArgs e)\n{\n    Game.Tick();\n\n    // Enables custom message pumping\n    InputMethod.PumpMessage();\n}\n```\n\n### Hook events\n\n```c#\nInputMethod.TextInputCallback = OnTextInput;\nInputMethod.TextCompositionCallback = OnTextComposition;\n```\n\n**Retrieve other composition info from `InputMethod.CandidateList` and other fields for CJK IMEs.**\n\n### Set position of OS rendered IME Candidate Window\n\n```c#\nInputMethod.SetTextInputRect(location.X, location.Y, 0, textBoxHeight);\n```\n\n## Test IMM32 implementation only\n\nIMM32 would be only enabled if TSF service is not available.\nYou can `return false` manually in `TextServicesLoader.ServicesInstalled` to mimic TSF unavailable case.\n\n## TODO\n\n- Make it work in Unity3d\n\n## MS Docs\n\n- [TSF Application](https://docs.microsoft.com/en-us/windows/win32/tsf/applications)\n- [TSF UILess Mode](https://docs.microsoft.com/en-us/windows/win32/tsf/uiless-mode-overview)\n- [TSF msctf.h header](https://docs.microsoft.com/en-us/windows/win32/api/msctf/)\n- [IMM32 Use IME in a Game](https://docs.microsoft.com/en-us/windows/win32/dxtecharts/using-an-input-method-editor-in-a-game)\n- [IMM32 imm.h header](https://docs.microsoft.com/en-us/windows/win32/api/imm/)\n\n## Other samples / implementations\n\n- [Chromium](https://github.com/chromium/chromium/tree/master/ui/base/ime/win)\n- [Windows Class Samples](https://github.com/microsoft/Windows-classic-samples/blob/master/Samples/IME/cpp/SampleIME)\n- [SDL2](https://github.com/spurious/SDL-mirror/blob/master/src/video/windows/SDL_windowskeyboard.c)\n- [WPF Core](https://github.com/dotnet/wpf/tree/master/src/Microsoft.DotNet.Wpf/src/PresentationCore/System/Windows/Input)\n\n## Credits\n\n- [WPF Core](https://github.com/dotnet/wpf)\n- [Chromium](https://github.com/chromium/chromium)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fryancheung%2Fimesharp","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fryancheung%2Fimesharp","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fryancheung%2Fimesharp/lists"}