Skip to content

Conversation

@RatinCN
Copy link

@RatinCN RatinCN commented Feb 29, 2024

The sample "DirectCompositionLayeredChildWindow" can compatible with Unicode build just make some very small changes.

And this PR also fix empty error message displayed due to

// Show error messages.
void CApplication::ShowErrorMessage(PCWSTR format, HRESULT hrErr)
{
    WCHAR msg[MAX_PATH];
    HRESULT hr = StringCbPrintf((STRSAFE_LPSTR)msg, sizeof(msg), (STRSAFE_LPCSTR)(L"%s (hr=0x%08X)"), format, hrErr);

    if (SUCCEEDED(hr))
    {
        MessageBox(NULL, (LPCSTR)msg, NULL, MB_ICONERROR);
    }
}

Where use %s to format a PCWSTR string even if in ANSI build.

Before:
Before

After:
After

Copy link

@zhuman zhuman left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would typically just update projects to use L"" strings and only support Unicode but this is fine too :-)

@RatinCN
Copy link
Author

RatinCN commented Sep 10, 2024

@ChrisGuzak Okay to move on?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants