Updated the Listbox Context Menu code to account for the context menu keyboard key. Thanks zeromus.

This commit is contained in:
ugetab 2010-05-10 22:50:21 +00:00
parent 0a2e4bf547
commit ef4af2ff0e
2 changed files with 17 additions and 11 deletions

View File

@ -355,10 +355,6 @@ BOOL CALLBACK CheatConsoleCallB(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM l
{
// Handle certain subborn context menus for nearly incapable controls.
// Only need 9, but I'd rather double it to be safe
//char TestHwnd[17];
//char TestwParam[17];
// Convert wParam to a string
sprintf(str,"%08x",wParam);
@ -371,7 +367,14 @@ BOOL CALLBACK CheatConsoleCallB(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM l
if (selcheat >= 0) {
// Open IDC_LIST_CHEATS Context Menu
hCheatcontextsub = GetSubMenu(hCheatcontext,0);
TrackPopupMenu(hCheatcontextsub,0,LOWORD(lParam),HIWORD(lParam),TPM_RIGHTBUTTON,hwndDlg,0); //Create menu
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
}
}
}

View File

@ -1171,10 +1171,6 @@ BOOL CALLBACK DebuggerCallB(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lPara
{
// Handle certain subborn context menus for nearly incapable controls.
// Only need 9, but I'd rather double it to be safe
//char TestHwnd[17];
//char TestwParam[17];
// Convert wParam to a string
sprintf(str,"%08x",wParam);
@ -1184,11 +1180,18 @@ BOOL CALLBACK DebuggerCallB(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lPara
// Compare the now-compatible data with strcmp.
if (!strcmp(str, str2)) {
// Only open the menu if a cheat is selected
int test = SendDlgItemMessage(hwndDlg,IDC_DEBUGGER_BP_LIST,LB_GETCURSEL,0,0);
if (SendDlgItemMessage(hwndDlg,IDC_DEBUGGER_BP_LIST,LB_GETCURSEL,0,0) >= 0) {
// Open IDC_LIST_CHEATS Context Menu
hDebugcontextsub = GetSubMenu(hDebugcontext,0);
TrackPopupMenu(hDebugcontextsub,0,LOWORD(lParam),HIWORD(lParam),TPM_RIGHTBUTTON,hwndDlg,0); //Create menu
if (lParam != -1)
TrackPopupMenu(hDebugcontextsub,0,LOWORD(lParam),HIWORD(lParam),TPM_RIGHTBUTTON,hwndDlg,0); //Create menu
else { // Handle the context menu keyboard key
GetWindowRect(GetDlgItem(hwndDlg,IDC_DEBUGGER_BP_LIST), &wrect);
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
}
}
}