diff --git a/src/drivers/win/cheat.cpp b/src/drivers/win/cheat.cpp index 30de7f02..64a5fd59 100644 --- a/src/drivers/win/cheat.cpp +++ b/src/drivers/win/cheat.cpp @@ -351,35 +351,28 @@ BOOL CALLBACK CheatConsoleCallB(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM l } break; - case WM_CONTEXTMENU: - { - // Handle certain subborn context menus for nearly incapable controls. - - // Convert wParam to a string - sprintf(str,"%08x",wParam); - - // Convert HWND of IDC_LIST_CHEATS to a string - sprintf(str2,"%08x",GetDlgItem(hwndDlg,IDC_LIST_CHEATS)); - - // Compare the now-compatible data with strcmp. - if (!strcmp(str, str2)) { - // Only open the menu if a cheat is selected - if (selcheat >= 0) { - // Open IDC_LIST_CHEATS Context Menu - hCheatcontextsub = GetSubMenu(hCheatcontext,0); - - if (lParam != -1) - TrackPopupMenu(hCheatcontextsub,0,LOWORD(lParam),HIWORD(lParam),TPM_RIGHTBUTTON,hwndDlg,0); //Create menu - else { // Handle the context menu keyboard key - GetWindowRect(GetDlgItem(hwndDlg,IDC_LIST_CHEATS), &wrect); - TrackPopupMenu(hCheatcontextsub,0,wrect.left + int((wrect.right - wrect.left) / 3),wrect.top + int((wrect.bottom - wrect.top) / 3),TPM_RIGHTBUTTON,hwndDlg,0); //Create menu - } + case WM_CONTEXTMENU: + { + // Handle certain subborn context menus for nearly incapable controls. + if (wParam == (uint32)GetDlgItem(hwndDlg,IDC_LIST_CHEATS)) { + // Only open the menu if a cheat is selected + if (selcheat >= 0) { + // Open IDC_LIST_CHEATS Context Menu + hCheatcontextsub = GetSubMenu(hCheatcontext,0); + + if (lParam != -1) + TrackPopupMenu(hCheatcontextsub,0,LOWORD(lParam),HIWORD(lParam),TPM_RIGHTBUTTON,hwndDlg,0); //Create menu + else { // Handle the context menu keyboard key + GetWindowRect(GetDlgItem(hwndDlg,IDC_LIST_CHEATS), &wrect); + TrackPopupMenu(hCheatcontextsub,0,wrect.left + int((wrect.right - wrect.left) / 3),wrect.top + int((wrect.bottom - wrect.top) / 3),TPM_RIGHTBUTTON,hwndDlg,0); //Create menu } + } - } - break; + + } + break; case WM_COMMAND: switch (HIWORD(wParam)) { diff --git a/src/drivers/win/debugger.cpp b/src/drivers/win/debugger.cpp index ea075793..8d84570f 100644 --- a/src/drivers/win/debugger.cpp +++ b/src/drivers/win/debugger.cpp @@ -1001,7 +1001,7 @@ void LoadGameDebuggerData(HWND hwndDlg = hDebug) { BOOL CALLBACK DebuggerCallB(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam) { RECT wrect; - char str[256]={0},str2[256]={0},*ptr,dotdot[4]; + char str[256]={0},*ptr,dotdot[4]; int tmp,tmp2; int mouse_x,mouse_y; int ret,i; @@ -1171,14 +1171,7 @@ BOOL CALLBACK DebuggerCallB(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lPara { // Handle certain subborn context menus for nearly incapable controls. - // Convert wParam to a string - sprintf(str,"%08x",wParam); - - // Convert HWND of IDC_LIST_CHEATS to a string - sprintf(str2,"%08x",GetDlgItem(hwndDlg,IDC_DEBUGGER_BP_LIST)); - - // Compare the now-compatible data with strcmp. - if (!strcmp(str, str2)) { + if (wParam == (uint32)GetDlgItem(hwndDlg,IDC_DEBUGGER_BP_LIST)) { // Only open the menu if a cheat is selected if (SendDlgItemMessage(hwndDlg,IDC_DEBUGGER_BP_LIST,LB_GETCURSEL,0,0) >= 0) { // Open IDC_LIST_CHEATS Context Menu @@ -1191,7 +1184,6 @@ BOOL CALLBACK DebuggerCallB(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lPara TrackPopupMenu(hDebugcontextsub,0,wrect.left + int((wrect.right - wrect.left) / 3),wrect.top + int((wrect.bottom - wrect.top) / 3),TPM_RIGHTBUTTON,hwndDlg,0); //Create menu } - } }