Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Make DirectCompositionLayeredChildWindow compatible with Unicode build #335

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

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

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.

None yet

1 participant