Home > Software engineering >  Windows program design of the scroll bar messages messagebox infinite pop up
Windows program design of the scroll bar messages messagebox infinite pop up

Time:09-24

case WM_VSCROLL:
The switch (LOWORD (wParam))
{
Case SB_LINEDOWN:
//please note here
Linedown MessageBox (HWND, TEXT (" "), TEXT (" scrollwindow "), MB_OK);
break;
Default:
break;
}
This is a piece of code of handling WM_VSCROLL message, a MessageBox function in the above, I used to watch my mouse to the operation process of slider, but I found a problem, that is my school official cites use the mouse to click the button down the slider to loosen, as long as the mouse on the location not removed and will popup hint window, that don't understand is why?

CodePudding user response:

Don't understand!!!!!!!!!!!!!!!!!!!!!!!!

CodePudding user response:

MessageBox change
AfxDump & lt; <"Linedown \ n";

CodePudding user response:

I don't want to know the MessageBox to afxDump & lt; <"Linedown \ n"; Why when loosen the left key of mouse, as long as the cursor moves to the picture scroll bar under of the small arrow on the pop-up window will be kept?

CodePudding user response:

Don't look at the log in a MessageBox.
Use OutputDebugString, debug mode, the log will be output to the "output" window, the debug mode, you can use the debugview

CodePudding user response:

/*
The WM_CANCELMODE message is sent to cancel certain modes, to The as mouse capture.
For example, the system sends this message to the active window
When a dialog box or message box is displayed.
Certain functions provides also send this message explicitly to the specified window
Chopped of been it is the active window.
For example, the EnableWindow function sends this message
The when disabling the specified window.
The Default Action
The DefWindowProc function cancels internal processing of standard scroll bar input,
Cancels internal menu processing,
And releases the mouse capture.
*/

MessageBox is a modal dialog box, affects the message, please be careful to use
You can also response WM_CANCELMODE

CodePudding user response:

 
Case WM_CANCELMODE:
//IMPORTANT MESSAGE! WM_CANCELMODE means that a
//dialog or some other modal process has started.
//we must make sure that we cancel any clicked state
//we are in, kill the timers, and release the capture.

StateClear (dwSpinnerState SPINNERSTATE_CLICKED);
If (bArrowTimed)
{
SendMessage (hParent, WM_VSCROLL MAKELONG (SB_ENDSCROLL,
HArrow, GetWindowLong (GWL_ID)), (LONG) hArrow);
HArrow, hArrow, KillTimer (GetWindowLong (GWL_ID));
BArrowTimed=FALSE;
}
ReleaseCapture ();
break;

CodePudding user response:

Thank you for your answer

CodePudding user response:

Set the focus of a try,

CodePudding user response:

refer to 6th floor schlafenhamster response:
 
Case WM_CANCELMODE:
//IMPORTANT MESSAGE! WM_CANCELMODE means that a
//dialog or some other modal process has started.
//we must make sure that we cancel any clicked state
//we are in, kill the timers, and release the capture.

StateClear (dwSpinnerState SPINNERSTATE_CLICKED);
If (bArrowTimed)
{
SendMessage (hParent, WM_VSCROLL MAKELONG (SB_ENDSCROLL,
HArrow, GetWindowLong (GWL_ID)), (LONG) hArrow);
HArrow, hArrow, KillTimer (GetWindowLong (GWL_ID));
BArrowTimed=FALSE;
}
ReleaseCapture ();
break;


Excuse me: bArrowTimed hParent hArrow song these three variables is what mean? StateClear (dwSpinnerState SPINNERSTATE_CLICKED); This function I also look not to understand? Please explain many thanks

CodePudding user response:

Is just one example
# define StateClear (dwState, wFlags) (dwState & amp;=~ (wFlags))
# define SPINNERSTATE_CLICKED (SPINNERSTATE_UPCLICK | SPINNERSTATE_DOWNCLICK)

The CListCtrl you couldn't find the Timer so not KillTimer, light ReleaseCapture (); Useless,
Conclusion is a WM_VSCROLL don't pop up in the modal dialog box!

CodePudding user response:

Good news, the timer ID found
Void CBmp45Dlg: : OnCancelMode ()
{//65534 timer ID of DLG 's sb
KillTimer (65534); //dialog scroll bar timer
ClipCursor (NULL);
ReleaseCapture ();
AfxDump & lt; <"OnCancelMode \ n";
}

CodePudding user response:

Win32 also available

Case WM_CANCELMODE:
KillTimer (HWND, 65534);//the timer of win 's sb
ClipCursor (0);
ReleaseCapture ();
Return 0;

Case WM_VSCROLL:
,,,
Case SB_LINEDOWN:
MessageBox (HWND, "xixi," "haha", MB_OK);
Si. NPos +=1;
Break;

CodePudding user response:

The
refer to 12 floor schlafenhamster reply:
win32 also available

Case WM_CANCELMODE:
KillTimer (HWND, 65534);//the timer of win 's sb
ClipCursor (0);
ReleaseCapture ();
Return 0;

Case WM_VSCROLL:
,,,
Case SB_LINEDOWN:
MessageBox (HWND, "xixi," "haha", MB_OK);
Si. NPos +=1;
Break;

nullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnull
  • Related