Home > Software engineering >  MFC PreTranslateMessage () overload response function
MFC PreTranslateMessage () overload response function

Time:09-22

If (pMsg - & gt; Message==WM_LBUTTONDOWN) {... }
Else if (pMsg - & gt; Message==WM_LBUTTONUP)
{
If (pMsg - & gt; HWND==GetDlgItem (IDC_BUTTON1_panleft) - & gt; M_hWnd)
{
.
return TRUE;
}
}
Return CDialog: : PreTranslateMessage (pMsg);


Rang IDC_BUTTON1_panleft this button up the other buttons after all can't use, click on the interface to any one place, all is the effect of press IDC_BUTTON1_panleft, how can I solve!!!!!!!!!!

CodePudding user response:

To return TRUE;

CodePudding user response:

reference 1st floor schlafenhamster response:
to return TRUE;

I have a cycle from the function can indeed but a variable will change, so the numerical is right but can cause this kind of situation,

CodePudding user response:

"Have a variable will change" on the code

CodePudding user response:

reference schlafenhamster reply: 3/f
"a variable will change" code


If (pMsg - & gt; HWND==GetDlgItem (IDC_BUTTON1_panleft) - & gt; M_hWnd) is a variable in a circulation loop with time changing, set breakpoints out cycle is a certain value, but a run return CDialog: : PreTranslateMessage (pMsg) this value can change for no apparent reason, don't know what's the matter,

CodePudding user response:

Using afxDump & lt; CodePudding user response:

PtInRect add a judgment, use this function to see the inside of the pMsg pt in is not in the button, the word is your current logic, if not return false, press this button after IDC_BUTTON1_panleft handle is activated, the message is sent to the handle, return true after other handle will not receive the news,
  • Related