MicrosoftDocs / windows-dev-docs

Conceptual and overview content for developing Windows apps
Creative Commons Attribution 4.0 International
697 stars 1.2k forks source link

Host a standard WinRT XAML control in a C++ desktop (Win32) app - Question #4135

Open petr-larin opened 1 year ago

petr-larin commented 1 year ago

Hi!

I'm following the tutorial Host a standard WinRT XAML control in a C++ desktop (Win32) app

and was wondering what is the purpose of this line in the code sample:

case WM_CREATE: _childhWnd = CreateWindowEx(0, L"ChildWClass", NULL, WS_CHILD | WS_BORDER, 0, 0, 0, 0, hWnd, NULL, _hInstance, NULL);

_childhWnd does not get created and GetLastError() returns 1407 = Cannot find window class. XAMLinWin32

Is this WM_CREATE handler relevant in any way to the XAML island hosting demo?

Thank you


Document Details

Do not edit this section. It is required for learn.microsoft.com ➟ GitHub issue linking.

petr-larin commented 1 year ago

It's quite clear that neither WM_CREATE nor WM_SIZE handlers have anything to do with XAML islands, so they should be removed from the code sample.

At the same time, the sample shows a "degenerate" example of the control, that is, a static text box. It would be good to see some dynamic UI control (a button or a slider) in action - especially how to retrieve and send messages to them from the Win32 environment?