{"id":18653074,"url":"https://github.com/pdawg-bytes/winrtcorewindow","last_synced_at":"2025-10-10T20:07:02.289Z","repository":{"id":230814722,"uuid":"780232018","full_name":"Pdawg-bytes/WinRTCoreWindow","owner":"Pdawg-bytes","description":"Hosting a raw CoreWindow on hWnd from C# or C++.","archived":false,"fork":false,"pushed_at":"2024-07-30T03:29:15.000Z","size":20,"stargazers_count":10,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-04-11T20:04:23.063Z","etag":null,"topics":["abi","corewindow","cpp","csharp","windows","winrt","winrtxaml","wrl","wux"],"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/Pdawg-bytes.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","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,"zenodo":null}},"created_at":"2024-04-01T03:01:31.000Z","updated_at":"2025-01-01T18:02:32.000Z","dependencies_parsed_at":"2024-04-01T05:32:41.487Z","dependency_job_id":"d8f34b32-c033-49f5-a171-b353e151617a","html_url":"https://github.com/Pdawg-bytes/WinRTCoreWindow","commit_stats":null,"previous_names":["pdawg-bytes/winrtcorewindow"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/Pdawg-bytes/WinRTCoreWindow","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Pdawg-bytes%2FWinRTCoreWindow","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Pdawg-bytes%2FWinRTCoreWindow/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Pdawg-bytes%2FWinRTCoreWindow/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Pdawg-bytes%2FWinRTCoreWindow/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Pdawg-bytes","download_url":"https://codeload.github.com/Pdawg-bytes/WinRTCoreWindow/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Pdawg-bytes%2FWinRTCoreWindow/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":259616381,"owners_count":22884883,"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":["abi","corewindow","cpp","csharp","windows","winrt","winrtxaml","wrl","wux"],"created_at":"2024-11-07T07:09:57.657Z","updated_at":"2025-10-10T20:06:57.244Z","avatar_url":"https://github.com/Pdawg-bytes.png","language":"C#","readme":"# WinRTCoreWindow\nHosting a raw CoreWindow on hWnd from C# or C++.\n\u003cbr/\u003e\n## Projects\n\n### WinRTCoreWindow.vcxproj\nThis is the project containing the C++ version of the code.\n\n### CoreWindowSharp.csproj\nThis is the project containing the C# version of the code.\n\n\u003e [!NOTE]  \n\u003e There are minor differences between the two to conform to each languages' standards, but they both achieve the same end result.\n\u003cbr/\u003e\n\n# How does it work?\n### C++:\n1. Load `Windows.UI.dll` and extract a function pointer out of it pointing to a private function (`CreateCoreWindow`).\n2. Cast that into the `PrivateCreateCoreWindow` delegate\n3. Init winrt (`winrt::init_apartment()`)\n4. Create a standard hWnd window (`CreateWindowEx` and `WNDCLASS`)\n5. Create a GUID referring to CoreWindow.\n6. Call the func pointer delegate, passing in the handle of that hWnd window and the GUID.\n7. Initialize the `XamlPresenter` (found in the internal version of `Windows.UI.Xaml.Hosting`)\n8. Init winrt components and set the content of the `XamlPresenter`.\n9. Init `ICoreDispatcher` with ptr to CoreWindow dispatcher\n10. Process dispatcher messages.\n\n### C#:\n1. `DllImport` the `Windows.UI.dll` library at ordinal 1500.\n2. Create a standard hWnd window (`CreateWindowEx` and `WNDCLASSEX`)\n3. Call `CreateCoreWindow` on the main thread and discard its output. (It's still initialized on the thread, so we don't need the output directly.)\n4. Set the `ICoreWindow` instance to `CoreWindow.GetForCurrentThread()`.\n5. Initialize the `XamlPresenter` (found in the internal version of `Windows.UI.Xaml.Hosting`).\n6. Init winrt components and set the content of the `XamlPresenter`.\n7. Extract the `ICoreDispatcher` as a `Windows.UI.Core.CoreDispatcher`.\n8. Command `CoreDispatcher` to start processing dispatcher messages.\n\u003cbr/\u003e\n\n# Demo\n![image](https://github.com/Pdawg-bytes/WinRTCoreWindow/assets/83825746/cab55c13-d3df-42dc-89ef-a2b375eea067)\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpdawg-bytes%2Fwinrtcorewindow","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fpdawg-bytes%2Fwinrtcorewindow","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpdawg-bytes%2Fwinrtcorewindow/lists"}