From: Mikko Rasa Date: Mon, 17 Jun 2019 22:34:52 +0000 (+0300) Subject: Use Get/SetWindowLongPtr X-Git-Url: http://git.tdb.fi/?a=commitdiff_plain;h=e16e661417f5ba370ec77da9cb1858d3477ad780;p=libs%2Fgui.git Use Get/SetWindowLongPtr Since sizeof(long) != sizeof(void *) on Windows, the non-Ptr versions do not work properly on 64-bit Windows. --- diff --git a/source/graphics/windows/window.cpp b/source/graphics/windows/window.cpp index c07fbae..977efcd 100644 --- a/source/graphics/windows/window.cpp +++ b/source/graphics/windows/window.cpp @@ -14,11 +14,11 @@ LRESULT CALLBACK wndproc_(HWND hwnd, UINT msg, WPARAM wparam, LPARAM lparam) if(msg==WM_CREATE) { CREATESTRUCT *cs = reinterpret_cast(lparam); - SetWindowLong(hwnd, 0, reinterpret_cast(cs->lpCreateParams)); + SetWindowLongPtr(hwnd, 0, reinterpret_cast(cs->lpCreateParams)); } else { - Msp::Graphics::Window *wnd = reinterpret_cast(GetWindowLong(hwnd, 0)); + Msp::Graphics::Window *wnd = reinterpret_cast(GetWindowLongPtr(hwnd, 0)); Msp::Graphics::Window::Event ev; ev.msg = msg; ev.wparam = wparam; @@ -117,8 +117,8 @@ void Window::platform_reconfigure(bool fullscreen_changed) bool was_visible = visible; if(was_visible) hide(); - SetWindowLong(priv->window, GWL_EXSTYLE, exstyle); - SetWindowLong(priv->window, GWL_STYLE, style); + SetWindowLongPtr(priv->window, GWL_EXSTYLE, exstyle); + SetWindowLongPtr(priv->window, GWL_STYLE, style); if(was_visible) show(); }