Examples: Win32: Always use RegisterClassW() to ensure windows are Unicode. (#5725)

This commit is contained in:
ocornut 2022-09-28 16:57:09 +02:00
parent e0330c1696
commit a229a7f39f
5 changed files with 21 additions and 20 deletions

View File

@ -154,6 +154,7 @@ Other Changes:
- Demo: Added more explicit "Center window" mode to "Overlay example". (#5618) - Demo: Added more explicit "Center window" mode to "Overlay example". (#5618)
- Demo: Fixed Log & Console from losing scrolling position with Auto-Scroll when child is clipped. (#5721) - Demo: Fixed Log & Console from losing scrolling position with Auto-Scroll when child is clipped. (#5721)
- Examples: Added all SDL examples to default VS solution. - Examples: Added all SDL examples to default VS solution.
- Examples: Win32: Always use RegisterClassW() to ensure windows are Unicode. (#5725)
- Backends: GLFW: Honor GLFW_CURSOR_DISABLED by not setting mouse position. (#5625) [@scorpion-26] - Backends: GLFW: Honor GLFW_CURSOR_DISABLED by not setting mouse position. (#5625) [@scorpion-26]
- Backends: SDL: Disable SDL 2.0.22 new "auto capture" which prevents drag and drop across windows - Backends: SDL: Disable SDL 2.0.22 new "auto capture" which prevents drag and drop across windows
(e.g. for multi-viewport support) and don't capture mouse when drag and dropping. (#5710) (e.g. for multi-viewport support) and don't capture mouse when drag and dropping. (#5710)

View File

@ -26,15 +26,15 @@ int main(int, char**)
{ {
// Create application window // Create application window
//ImGui_ImplWin32_EnableDpiAwareness(); //ImGui_ImplWin32_EnableDpiAwareness();
WNDCLASSEX wc = { sizeof(WNDCLASSEX), CS_CLASSDC, WndProc, 0L, 0L, GetModuleHandle(NULL), NULL, NULL, NULL, NULL, _T("ImGui Example"), NULL }; WNDCLASSEXW wc = { sizeof(wc), CS_CLASSDC, WndProc, 0L, 0L, GetModuleHandle(NULL), NULL, NULL, NULL, NULL, L"ImGui Example", NULL };
::RegisterClassEx(&wc); ::RegisterClassExW(&wc);
HWND hwnd = ::CreateWindow(wc.lpszClassName, _T("Dear ImGui DirectX10 Example"), WS_OVERLAPPEDWINDOW, 100, 100, 1280, 800, NULL, NULL, wc.hInstance, NULL); HWND hwnd = ::CreateWindowW(wc.lpszClassName, L"Dear ImGui DirectX10 Example", WS_OVERLAPPEDWINDOW, 100, 100, 1280, 800, NULL, NULL, wc.hInstance, NULL);
// Initialize Direct3D // Initialize Direct3D
if (!CreateDeviceD3D(hwnd)) if (!CreateDeviceD3D(hwnd))
{ {
CleanupDeviceD3D(); CleanupDeviceD3D();
::UnregisterClass(wc.lpszClassName, wc.hInstance); ::UnregisterClassW(wc.lpszClassName, wc.hInstance);
return 1; return 1;
} }
@ -154,7 +154,7 @@ int main(int, char**)
CleanupDeviceD3D(); CleanupDeviceD3D();
::DestroyWindow(hwnd); ::DestroyWindow(hwnd);
::UnregisterClass(wc.lpszClassName, wc.hInstance); ::UnregisterClassW(wc.lpszClassName, wc.hInstance);
return 0; return 0;
} }

View File

@ -26,15 +26,15 @@ int main(int, char**)
{ {
// Create application window // Create application window
//ImGui_ImplWin32_EnableDpiAwareness(); //ImGui_ImplWin32_EnableDpiAwareness();
WNDCLASSEX wc = { sizeof(WNDCLASSEX), CS_CLASSDC, WndProc, 0L, 0L, GetModuleHandle(NULL), NULL, NULL, NULL, NULL, _T("ImGui Example"), NULL }; WNDCLASSEXW wc = { sizeof(wc), CS_CLASSDC, WndProc, 0L, 0L, GetModuleHandle(NULL), NULL, NULL, NULL, NULL, L"ImGui Example", NULL };
::RegisterClassEx(&wc); ::RegisterClassExW(&wc);
HWND hwnd = ::CreateWindow(wc.lpszClassName, _T("Dear ImGui DirectX11 Example"), WS_OVERLAPPEDWINDOW, 100, 100, 1280, 800, NULL, NULL, wc.hInstance, NULL); HWND hwnd = ::CreateWindowW(wc.lpszClassName, L"Dear ImGui DirectX11 Example", WS_OVERLAPPEDWINDOW, 100, 100, 1280, 800, NULL, NULL, wc.hInstance, NULL);
// Initialize Direct3D // Initialize Direct3D
if (!CreateDeviceD3D(hwnd)) if (!CreateDeviceD3D(hwnd))
{ {
CleanupDeviceD3D(); CleanupDeviceD3D();
::UnregisterClass(wc.lpszClassName, wc.hInstance); ::UnregisterClassW(wc.lpszClassName, wc.hInstance);
return 1; return 1;
} }
@ -155,7 +155,7 @@ int main(int, char**)
CleanupDeviceD3D(); CleanupDeviceD3D();
::DestroyWindow(hwnd); ::DestroyWindow(hwnd);
::UnregisterClass(wc.lpszClassName, wc.hInstance); ::UnregisterClassW(wc.lpszClassName, wc.hInstance);
return 0; return 0;
} }

View File

@ -61,15 +61,15 @@ int main(int, char**)
{ {
// Create application window // Create application window
//ImGui_ImplWin32_EnableDpiAwareness(); //ImGui_ImplWin32_EnableDpiAwareness();
WNDCLASSEX wc = { sizeof(WNDCLASSEX), CS_CLASSDC, WndProc, 0L, 0L, GetModuleHandle(NULL), NULL, NULL, NULL, NULL, _T("ImGui Example"), NULL }; WNDCLASSEXW wc = { sizeof(wc), CS_CLASSDC, WndProc, 0L, 0L, GetModuleHandle(NULL), NULL, NULL, NULL, NULL, L"ImGui Example", NULL };
::RegisterClassEx(&wc); ::RegisterClassExW(&wc);
HWND hwnd = ::CreateWindow(wc.lpszClassName, _T("Dear ImGui DirectX12 Example"), WS_OVERLAPPEDWINDOW, 100, 100, 1280, 800, NULL, NULL, wc.hInstance, NULL); HWND hwnd = ::CreateWindowW(wc.lpszClassName, L"Dear ImGui DirectX12 Example", WS_OVERLAPPEDWINDOW, 100, 100, 1280, 800, NULL, NULL, wc.hInstance, NULL);
// Initialize Direct3D // Initialize Direct3D
if (!CreateDeviceD3D(hwnd)) if (!CreateDeviceD3D(hwnd))
{ {
CleanupDeviceD3D(); CleanupDeviceD3D();
::UnregisterClass(wc.lpszClassName, wc.hInstance); ::UnregisterClassW(wc.lpszClassName, wc.hInstance);
return 1; return 1;
} }
@ -223,7 +223,7 @@ int main(int, char**)
CleanupDeviceD3D(); CleanupDeviceD3D();
::DestroyWindow(hwnd); ::DestroyWindow(hwnd);
::UnregisterClass(wc.lpszClassName, wc.hInstance); ::UnregisterClassW(wc.lpszClassName, wc.hInstance);
return 0; return 0;
} }

View File

@ -24,15 +24,15 @@ int main(int, char**)
{ {
// Create application window // Create application window
//ImGui_ImplWin32_EnableDpiAwareness(); //ImGui_ImplWin32_EnableDpiAwareness();
WNDCLASSEX wc = { sizeof(WNDCLASSEX), CS_CLASSDC, WndProc, 0L, 0L, GetModuleHandle(NULL), NULL, NULL, NULL, NULL, _T("ImGui Example"), NULL }; WNDCLASSEXW wc = { sizeof(wc), CS_CLASSDC, WndProc, 0L, 0L, GetModuleHandle(NULL), NULL, NULL, NULL, NULL, L"ImGui Example", NULL };
::RegisterClassEx(&wc); ::RegisterClassExW(&wc);
HWND hwnd = ::CreateWindow(wc.lpszClassName, _T("Dear ImGui DirectX9 Example"), WS_OVERLAPPEDWINDOW, 100, 100, 1280, 800, NULL, NULL, wc.hInstance, NULL); HWND hwnd = ::CreateWindowW(wc.lpszClassName, L"Dear ImGui DirectX9 Example", WS_OVERLAPPEDWINDOW, 100, 100, 1280, 800, NULL, NULL, wc.hInstance, NULL);
// Initialize Direct3D // Initialize Direct3D
if (!CreateDeviceD3D(hwnd)) if (!CreateDeviceD3D(hwnd))
{ {
CleanupDeviceD3D(); CleanupDeviceD3D();
::UnregisterClass(wc.lpszClassName, wc.hInstance); ::UnregisterClassW(wc.lpszClassName, wc.hInstance);
return 1; return 1;
} }
@ -161,7 +161,7 @@ int main(int, char**)
CleanupDeviceD3D(); CleanupDeviceD3D();
::DestroyWindow(hwnd); ::DestroyWindow(hwnd);
::UnregisterClass(wc.lpszClassName, wc.hInstance); ::UnregisterClassW(wc.lpszClassName, wc.hInstance);
return 0; return 0;
} }