From bb9df81fd2e6eb72f968308cab940535936279fe Mon Sep 17 00:00:00 2001 From: H.G. Muller Date: Fri, 4 Feb 2011 10:22:29 +0100 Subject: [PATCH] Fix 64-bit Windows compilability The API interface for Set/GetWindowLong has been changed for 64-bit Windows, both in the name of the call as in the arguments. --- winboard/wchat.c | 2 +- winboard/winboard.c | 20 ++++++++++---------- 2 files changed, 11 insertions(+), 11 deletions(-) diff --git a/winboard/wchat.c b/winboard/wchat.c index 97c060b..835f494 100644 --- a/winboard/wchat.c +++ b/winboard/wchat.c @@ -221,7 +221,7 @@ LRESULT CALLBACK ChatProc( HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam SendMessage(hMemo, EM_SETEVENTMASK, 0, wMask | ENM_LINK); SendMessage(hMemo, EM_AUTOURLDETECT, TRUE, 0L); chatInputWindowProc = (WNDPROC) // cloned from ConsoleWndProc(). Assume they all share same proc. - SetWindowLong(GetDlgItem(hDlg, OPT_ChatInput), GWL_WNDPROC, (LONG) InterceptArrowKeys); + SetWindowLongPtr(GetDlgItem(hDlg, OPT_ChatInput), GWLP_WNDPROC, (LONG_PTR) InterceptArrowKeys); return FALSE; case WM_NOTIFY: diff --git a/winboard/winboard.c b/winboard/winboard.c index f27a1e6..08284bc 100644 --- a/winboard/winboard.c +++ b/winboard/winboard.c @@ -2223,7 +2223,7 @@ InitDrawingSizes(BoardSize boardSize, int flags) } if (tinyLayout != oldTinyLayout) { - long style = GetWindowLong(hwndMain, GWL_STYLE); + long style = GetWindowLongPtr(hwndMain, GWL_STYLE); if (tinyLayout) { style &= ~WS_SYSMENU; InsertMenu(hmenu, IDM_Exit, MF_BYCOMMAND, IDM_Minimize, @@ -2232,7 +2232,7 @@ InitDrawingSizes(BoardSize boardSize, int flags) style |= WS_SYSMENU; RemoveMenu(hmenu, IDM_Minimize, MF_BYCOMMAND); } - SetWindowLong(hwndMain, GWL_STYLE, style); + SetWindowLongPtr(hwndMain, GWL_STYLE, style); for (i=0; menuBarText[tinyLayout][i]; i++) { ModifyMenu(hmenu, i, MF_STRING|MF_BYPOSITION|MF_POPUP, @@ -2381,7 +2381,7 @@ InitDrawingSizes(BoardSize boardSize, int flags) boardRect.right - BUTTON_WIDTH*(N_BUTTONS-i), messageRect.top, BUTTON_WIDTH, messageSize.cy, hwndMain, (HMENU) buttonDesc[i].id, - (HINSTANCE) GetWindowLong(hwndMain, GWL_HINSTANCE), NULL); + (HINSTANCE) GetWindowLongPtr(hwndMain, GWLP_HINSTANCE), NULL); if (tinyLayout) { SendMessage(buttonDesc[i].hwnd, WM_SETFONT, (WPARAM)font[boardSize][MESSAGE_FONT]->hf, @@ -2390,7 +2390,7 @@ InitDrawingSizes(BoardSize boardSize, int flags) if (buttonDesc[i].id == IDM_Pause) hwndPause = buttonDesc[i].hwnd; buttonDesc[i].wndproc = (WNDPROC) - SetWindowLong(buttonDesc[i].hwnd, GWL_WNDPROC, (LONG) ButtonProc); + SetWindowLongPtr(buttonDesc[i].hwnd, GWLP_WNDPROC, (LONG_PTR) ButtonProc); } } if (gridPen != NULL) DeleteObject(gridPen); @@ -4240,7 +4240,7 @@ MouseEvent(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam) LRESULT CALLBACK ButtonProc(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam) { - int id = GetWindowLong(hwnd, GWL_ID); + int id = GetWindowLongPtr(hwnd, GWLP_ID); int i, dir; for (i=0; i