https://github.com/windowsnt/uwplib
A library to use UWP controls as plain Win32 controls
https://github.com/windowsnt/uwplib
cpplusplus uwp win32
Last synced: 21 days ago
JSON representation
A library to use UWP controls as plain Win32 controls
- Host: GitHub
- URL: https://github.com/windowsnt/uwplib
- Owner: WindowsNT
- Created: 2019-03-20T22:08:11.000Z (about 6 years ago)
- Default Branch: master
- Last Pushed: 2020-02-04T12:17:51.000Z (about 5 years ago)
- Last Synced: 2025-03-24T13:36:07.938Z (about 1 month ago)
- Topics: cpplusplus, uwp, win32
- Language: C++
- Size: 1.21 MB
- Stars: 40
- Watchers: 8
- Forks: 9
- Open Issues: 0
-
Metadata Files:
- Readme: Readme.md
Awesome Lists containing this project
README
# A simple UWP Wrapper for Win32
CodeProject article: https://www.codeproject.com/Articles/1279856/UwpAX-A-small-library-for-including-Xaml-controls
# UWPLib
It's a library that allows you to use an UWP control as a HWND.
1. Create an app with the attached manifest
2. Call winrt::init_apartment(apartment_type::single_threaded);
3. Call WindowsXamlManager::InitializeForCurrentThread();
4. Call Register()
5. Create windows with UWP_Custom class and use WM_SETTEXT to set the Xaml.
6. The control returns an UWPCONTROL pointer which you can use to manipulate the IInspectable```C++
struct UWPCONTROL
{
DesktopWindowXamlSource xs;
HWND hParent = 0;
HWND hwnd = 0;
HWND hwndDetailXamlIsland = 0;
winrt::Windows::Foundation::IInspectable ins;
};auto pv = LR"(
)";SetWindowText(GetDlgItem(hh, 901), pv);
UWPLIB::UWPCONTROL* u = (UWPLIB::UWPCONTROL*)SendDlgItemMessage(hh, 901, UWPM_GET_CONTROL, 0, 0);
auto pivot = u->ins.as();
...
```An example of a DLL that can be called from an ordinary Win32 app is also there in UWP directory. This dll exports a function that can transform a HMENU to an UWP menu and the Win32 can display it.








