From 13358200a84d28eb66d1a233adb0fda332cb191d Mon Sep 17 00:00:00 2001 From: Vadim Lopatin Date: Fri, 5 Dec 2014 13:47:02 +0300 Subject: [PATCH] fix Win32 build to avoid using version def Unicode --- dlanguilib.visualdproj | 2 +- dub.json | 3 --- examples/example1/dub.json | 3 --- examples/example1/example1.visualdproj | 2 +- examples/helloworld/dub.json | 3 --- examples/helloworld/helloworld.visualdproj | 2 +- src/dlangui/platforms/windows/winapp.d | 14 +++++++------- 7 files changed, 10 insertions(+), 19 deletions(-) diff --git a/dlanguilib.visualdproj b/dlanguilib.visualdproj index a0cfafff..f390a430 100644 --- a/dlanguilib.visualdproj +++ b/dlanguilib.visualdproj @@ -66,7 +66,7 @@ 0 0 - Unicode + 0 0 1 diff --git a/dub.json b/dub.json index 731f6376..ceac7b70 100644 --- a/dub.json +++ b/dub.json @@ -5,9 +5,6 @@ "license": "Boost", "authors": ["Vadim Lopatin"], "targetType": "none", - - "versions": ["Unicode"], - "subPackages": [ { "versions-windows": ["Unicode"], diff --git a/examples/example1/dub.json b/examples/example1/dub.json index 4b65d4ca..163d8ea6 100644 --- a/examples/example1/dub.json +++ b/examples/example1/dub.json @@ -80,9 +80,6 @@ "libs-windows": ["dlanguilib", "phobos", "ole32", "kernel32", "user32", "comctl32", "comdlg32"], - "versions": ["Unicode"], - - "dependencies": { "dlangui:dlanguilib": "~master", "derelict-sdl2": "~master", diff --git a/examples/example1/example1.visualdproj b/examples/example1/example1.visualdproj index e512f911..7bdbb952 100644 --- a/examples/example1/example1.visualdproj +++ b/examples/example1/example1.visualdproj @@ -66,7 +66,7 @@ 0 0 - Unicode + 0 3 0 diff --git a/examples/helloworld/dub.json b/examples/helloworld/dub.json index a70ac8d5..4db24c46 100644 --- a/examples/helloworld/dub.json +++ b/examples/helloworld/dub.json @@ -78,9 +78,6 @@ "libs-windows": ["dlanguilib", "phobos", "ole32", "kernel32", "user32", "comctl32", "comdlg32"], - "versions": ["Unicode"], - - "dependencies": { "dlangui:dlanguilib": "~master", "derelict-gl3": "~master", diff --git a/examples/helloworld/helloworld.visualdproj b/examples/helloworld/helloworld.visualdproj index 95fe8457..7a1bb02e 100644 --- a/examples/helloworld/helloworld.visualdproj +++ b/examples/helloworld/helloworld.visualdproj @@ -66,7 +66,7 @@ 0 0 - Unicode USE_OPENGL USE_SDL + 0 3 0 diff --git a/src/dlangui/platforms/windows/winapp.d b/src/dlangui/platforms/windows/winapp.d index 19498a9b..85e02640 100644 --- a/src/dlangui/platforms/windows/winapp.d +++ b/src/dlangui/platforms/windows/winapp.d @@ -150,7 +150,7 @@ class Win32Window : Window { ws |= WS_OVERLAPPED | WS_CAPTION | WS_CAPTION | WS_BORDER | WS_SYSMENU; //if (flags & WindowFlag.Fullscreen) // ws |= SDL_WINDOW_FULLSCREEN; - _hwnd = CreateWindow(toUTF16z(WIN_CLASS_NAME), // window class name + _hwnd = CreateWindowW(toUTF16z(WIN_CLASS_NAME), // window class name toUTF16z(windowCaption), // window caption ws, // window style CW_USEDEFAULT, // initial x position @@ -611,7 +611,7 @@ class Win32Platform : Platform { } bool registerWndClass() { //MSG msg; - WNDCLASS wndclass; + WNDCLASSW wndclass; wndclass.style = CS_HREDRAW | CS_VREDRAW | CS_OWNDC; wndclass.lpfnWndProc = &WndProc; @@ -624,7 +624,7 @@ class Win32Platform : Platform { wndclass.lpszMenuName = null; wndclass.lpszClassName = toUTF16z(WIN_CLASS_NAME); - if(!RegisterClass(&wndclass)) + if(!RegisterClassW(&wndclass)) { return false; } @@ -696,7 +696,7 @@ class Win32Platform : Platform { HGLOBAL hglb = GetClipboardData(CF_UNICODETEXT); if (hglb != NULL) { - LPTSTR lptstr = cast(LPTSTR)GlobalLock(hglb); + LPWSTR lptstr = cast(LPWSTR)GlobalLock(hglb); if (lptstr != NULL) { wstring w = fromWStringz(lptstr); @@ -726,7 +726,7 @@ class Win32Platform : Platform { CloseClipboard(); return; } - LPTSTR lptstrCopy = cast(LPTSTR)GlobalLock(hglbCopy); + LPWSTR lptstrCopy = cast(LPWSTR)GlobalLock(hglbCopy); for (int i = 0; i < w.length; i++) { lptstrCopy[i] = w[i]; } @@ -751,7 +751,7 @@ int DLANGUIWinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, } catch (Throwable e) // catch any uncaught exceptions { - MessageBox(null, toUTF16z(e.toString()), "Error", + MessageBoxW(null, toUTF16z(e.toString()), "Error", MB_OK | MB_ICONEXCLAMATION); result = 0; // failed } @@ -945,7 +945,7 @@ LRESULT WndProc(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam) } } } - return 0; + break; case WM_MOUSELEAVE: case WM_MOUSEMOVE: case WM_LBUTTONDOWN: