From 69292b62ae8ff83e67893710753a41cefc76b24a Mon Sep 17 00:00:00 2001 From: OBattler Date: Thu, 18 May 2017 21:15:37 +0200 Subject: [PATCH] More such WindowLong fixes in win.c; Fixed CD-ROM Bus setting in Settings. --- src/WIN/win.c | 13 +++++-------- src/WIN/win_settings.c | 4 ++-- 2 files changed, 7 insertions(+), 10 deletions(-) diff --git a/src/WIN/win.c b/src/WIN/win.c index cec80f549..39d31d071 100644 --- a/src/WIN/win.c +++ b/src/WIN/win.c @@ -1255,7 +1255,7 @@ int WINAPI WinMain (HINSTANCE hThisInstance, hwndStatus = EmulatorStatusBar(hwnd, IDC_STATUS, hThisInstance); - OriginalStatusBarProcedure = GetWindowLongPtr(hwndStatus, GWL_WNDPROC); + OriginalStatusBarProcedure = GetWindowLongPtr(hwndStatus, GWLP_WNDPROC); SetWindowLongPtr(hwndStatus, GWL_WNDPROC, (LONG_PTR) &StatusBarProcedure); smenu = LoadMenu(hThisInstance, TEXT("StatusBarMenu")); @@ -1273,10 +1273,8 @@ int WINAPI WinMain (HINSTANCE hThisInstance, } } - if (vid_resize) SetWindowLong(hwnd, GWL_STYLE, WS_OVERLAPPEDWINDOW|WS_VISIBLE); - else SetWindowLong(hwnd, GWL_STYLE, (WS_OVERLAPPEDWINDOW&~WS_SIZEBOX&~WS_THICKFRAME&~WS_MAXIMIZEBOX)|WS_VISIBLE); - - SetWindowLong(hwnd, GWL_STYLE, GetWindowLong(hwnd, GWL_STYLE) & ~WS_MINIMIZEBOX); + if (vid_resize) SetWindowLongPtr(hwnd, GWL_STYLE, (WS_OVERLAPPEDWINDOW&~WS_MINIMIZEBOX)|WS_VISIBLE); + else SetWindowLongPtr(hwnd, GWL_STYLE, (WS_OVERLAPPEDWINDOW&~WS_SIZEBOX&~WS_THICKFRAME&~WS_MAXIMIZEBOX&~WS_MINIMIZEBOX)|WS_VISIBLE); /* Note by Kiririn: I've redone this since the CD-ROM can be disabled but still have something inside it. */ for (e = 0; e < CDROM_NUM; e++) @@ -1754,9 +1752,8 @@ LRESULT CALLBACK WindowProcedure (HWND hwnd, UINT message, WPARAM wParam, LPARAM case IDM_VID_RESIZE: vid_resize=!vid_resize; CheckMenuItem(hmenu, IDM_VID_RESIZE, (vid_resize)?MF_CHECKED:MF_UNCHECKED); - if (vid_resize) SetWindowLong(hwnd, GWL_STYLE, WS_OVERLAPPEDWINDOW|WS_VISIBLE); - else SetWindowLong(hwnd, GWL_STYLE, (WS_OVERLAPPEDWINDOW&~WS_SIZEBOX&~WS_THICKFRAME&~WS_MAXIMIZEBOX)|WS_VISIBLE); - SetWindowLong(hwnd, GWL_STYLE, GetWindowLong(hwnd, GWL_STYLE) & ~WS_MINIMIZEBOX); + if (vid_resize) SetWindowLongPtr(hwnd, GWL_STYLE, (WS_OVERLAPPEDWINDOW&~WS_MINIMIZEBOX)|WS_VISIBLE); + else SetWindowLongPtr(hwnd, GWL_STYLE, (WS_OVERLAPPEDWINDOW&~WS_SIZEBOX&~WS_THICKFRAME&~WS_MAXIMIZEBOX&~WS_MINIMIZEBOX)|WS_VISIBLE); GetWindowRect(hwnd,&rect); SetWindowPos(hwnd, 0, rect.left, rect.top, rect.right - rect.left, rect.bottom - rect.top, SWP_NOZORDER | SWP_FRAMECHANGED); GetWindowRect(hwndStatus,&rect); diff --git a/src/WIN/win_settings.c b/src/WIN/win_settings.c index 6916bca28..522fd7b19 100644 --- a/src/WIN/win_settings.c +++ b/src/WIN/win_settings.c @@ -3355,7 +3355,7 @@ static BOOL CALLBACK win_settings_removable_devices_proc(HWND hdlg, UINT message h = GetDlgItem(hdlg, IDC_COMBO_CD_BUS); if (temp_cdrom_drives[cdlv_current_sel].bus_type > 1) { - SendMessage(h, CB_SETCURSEL, temp_cdrom_drives[cdlv_current_sel].bus_type, 0); + SendMessage(h, CB_SETCURSEL, temp_cdrom_drives[cdlv_current_sel].bus_type - 1, 0); } else { @@ -3413,7 +3413,7 @@ static BOOL CALLBACK win_settings_removable_devices_proc(HWND hdlg, UINT message h = GetDlgItem(hdlg, IDC_COMBO_CD_BUS); if (temp_cdrom_drives[cdlv_current_sel].bus_type > 1) { - SendMessage(h, CB_SETCURSEL, temp_cdrom_drives[cdlv_current_sel].bus_type, 0); + SendMessage(h, CB_SETCURSEL, temp_cdrom_drives[cdlv_current_sel].bus_type - 1, 0); } else {