Skip to content

Sample code is not working #4194

Open
Open
@vgromfeld

Description

@vgromfeld

The sample code described in the page is not working.

The sample's message pump is incorrect.

It should be something as:

auto xamlSourceNative2 = desktopSource.as<IDesktopWindowXamlSourceNative>();
 while (GetMessage(&msg, nullptr, 0, 0))
    {
        BOOL messageProcessedByXaml = FALSE;
        check_hresult(xamlSourceNative2->PreTranslateMessage(&msg, &messageProcessedByXaml));

        if (!messageProcessedByXaml && !TranslateAccelerator(msg.hwnd, hAccelTable, &msg))
        {
            TranslateMessage(&msg);
            DispatchMessage(&msg);
        }
    }

Document Details

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

Metadata

Metadata

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions