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
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -121,23 +121,23 @@ HRESULT CApplication::InitializeMainWindow()
wc.hInstance = m_hInstance;
wc.hCursor = LoadCursor(NULL, IDC_ARROW);
wc.hbrBackground = static_cast<HBRUSH>(GetStockObject(BLACK_BRUSH));
wc.lpszClassName = "DirectComposition Window Class";
wc.lpszClassName = TEXT("DirectComposition Window Class");

RegisterClassEx(&wc);

// Creates the m_hMainWindow window.
m_hMainWindow = CreateWindowEx(WS_EX_OVERLAPPEDWINDOW, // Extended window style
wc.lpszClassName, // Name of window class
"DirectComposition Layered Child Window Sample", // Title-bar string
WS_OVERLAPPED | WS_SYSMENU, // Top-level window
CW_USEDEFAULT, // Horizontal position
CW_USEDEFAULT, // Vertical position
1000, // Width
700, // Height
NULL, // Parent
NULL, // Class menu
GetModuleHandle(NULL), // Handle to application instance
NULL // Window-creation data
m_hMainWindow = CreateWindowEx(WS_EX_OVERLAPPEDWINDOW, // Extended window style
wc.lpszClassName, // Name of window class
TEXT("DirectComposition Layered Child Window Sample"), // Title-bar string
WS_OVERLAPPED | WS_SYSMENU, // Top-level window
CW_USEDEFAULT, // Horizontal position
CW_USEDEFAULT, // Vertical position
1000, // Width
700, // Height
NULL, // Parent
NULL, // Class menu
GetModuleHandle(NULL), // Handle to application instance
NULL // Window-creation data
);

if (!m_hMainWindow)
Expand Down Expand Up @@ -210,7 +210,7 @@ HRESULT CApplication::InitializeLayeredChildWindows()
wcex.lpfnWndProc = WindowProc;
wcex.hCursor = LoadCursor(NULL, IDC_ARROW);
wcex.hbrBackground = static_cast<HBRUSH>(GetStockObject(BLACK_BRUSH));
wcex.lpszClassName = "DirectCompositionChildWindow-Child";
wcex.lpszClassName = TEXT("DirectCompositionChildWindow-Child");

RegisterClassEx(&wcex);

Expand Down Expand Up @@ -283,8 +283,8 @@ HRESULT CApplication::InitializeLayeredChildWindows()

// Create Play/Stop button.
m_hwndButton[0] = CreateWindowEx(WS_EX_TOPMOST,
"BUTTON",
"Play/Stop",
TEXT("BUTTON"),
TEXT("Play/Stop"),
WS_TABSTOP | WS_VISIBLE | WS_CHILD | BS_PUSHBUTTON,
50,
50,
Expand All @@ -305,8 +305,8 @@ HRESULT CApplication::InitializeLayeredChildWindows()
{
// Create Rotate button.
m_hwndButton[1] = CreateWindowEx(WS_EX_TOPMOST,
"BUTTON",
"Rotate",
TEXT("BUTTON"),
TEXT("Rotate"),
WS_TABSTOP | WS_VISIBLE | WS_CHILD | BS_PUSHBUTTON,
180,
50,
Expand All @@ -327,8 +327,8 @@ HRESULT CApplication::InitializeLayeredChildWindows()
{
// Create Scale button.
m_hwndButton[2] = CreateWindowEx(WS_EX_TOPMOST,
"BUTTON",
"Scale",
TEXT("BUTTON"),
TEXT("Scale"),
WS_TABSTOP | WS_VISIBLE | WS_CHILD | BS_PUSHBUTTON,
310,
50,
Expand All @@ -349,8 +349,8 @@ HRESULT CApplication::InitializeLayeredChildWindows()
{
// Create Skew button.
m_hwndButton[3] = CreateWindowEx(WS_EX_TOPMOST,
"BUTTON",
"Skew",
TEXT("BUTTON"),
TEXT("Skew"),
WS_TABSTOP | WS_VISIBLE | WS_CHILD | BS_PUSHBUTTON,
440,
50,
Expand Down Expand Up @@ -1430,12 +1430,12 @@ HRESULT CApplication::CloakWindow(BOOL cloakHwnd, HWND hwnd)
// 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);
TCHAR msg[MAX_PATH];
HRESULT hr = StringCbPrintf(msg, sizeof(msg), TEXT("%ls (hr=0x%08lX)"), format, hrErr);

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

Expand Down