Home > Software engineering >  How to get the mouse on Win32 window position in the window?
How to get the mouse on Win32 window position in the window?

Time:11-23

A freshman summer internships,,
 case WM_LBUTTONDOWN: 
{
Pt. X=LOWORD (lParam);
Pt. Y=HIWORD (lParam);
}


But under the LOWORD have wavy lines,,, say undefined identifiers lParam,,, for help, and don't look for a few hours

CodePudding user response:

This is undefined, the parameters of the function is not this variable, you according to you the function of the corresponding variable

CodePudding user response:

Baidu search "WM_LBUTTONDOWN"

CodePudding user response:

Your function parameter name is not correct,
It must be... WndProc (... LPARAM LPARAM)... ah

CodePudding user response:

Case WM_LBUTTONDOWN:
Should be in the
LRESULT a CALLBACK MainWndProc (HWND HWND, UINT message, WPARAM WPARAM, LPARAM LPARAM)
In the

CodePudding user response:

GetCursorPos first, to get the coordinates of the screen, and then using ScreenToClient change my good

CodePudding user response:

Freshmen have internships, good

CodePudding user response:

Pt. X=LOWORD (lParam);
Pt. Y=HIWORD (lParam); You this 2 xy is what kind of forced into what types of
Pt. X=double (wParam);
Pt. Y=double (lParam);

CodePudding user response:

WM_LBUTTONDOWN fwKeys=wParam;
XPos=LOWORD (lParam);
YPos=HIWORD (lParam);

Did you check your window procedure function is how to write?

CodePudding user response:

Pt. X=LOWORD (lParam);
Pt. Y=HIWORD (lParam);

CodePudding user response:

 
Case WM_RBUTTONDOWN:
Case WM_LBUTTONDOWN:
//the When we get a mouse down the message, we know that the mouse
//is over the control. We then do the following steps
//to set up the new state:
//1. Hit - test the coordinates of the click to
//determine in which half the click occurred.
//2. Set the appropriate SPINNERSTATE_ * CLICK state
//and repaint that clicked half. This is another
//example of a change - state - and - repaint strategy.
//3. Send an initial scroll message.
//4. Set the mouse capture.
//5. Set the initial delay timer before repeating
//the scroll message.

//if (uRightBt) break;
URightBt=message;
//Get the mouse coordinates.
X=(int) LOWORD (lParam);
Y=(int) HIWORD (lParam);
//Only need to hit - test the upper half Then change - state - and - repaint
GetClientRect (hArrow, & amp; The rect);
Cy=the rect. Bottom & gt;> 1;///2
//
If (y & gt; Cy)
{
StateSet (dwSpinnerState SPINNERSTATE_DOWNCLICK);
The rect. Top=cy;
WScroll=SB_LINEDOWN;
}
The else
{
StateSet (dwSpinnerState SPINNERSTATE_UPCLICK);
The rect. Bottom=cy + 1;
WScroll=SB_LINEUP;
}
//
HArrow, SetWindowLong (GWL_SPINNERSTATE, (LONG) dwSpinnerState);

HArrow, InvalidateRect (& amp; The rect, TRUE);
UpdateWindow (hArrow);

SetCapture (hArrow);

//Process the SHIFT key state along with the button message

If (wParam & amp; MK_SHIFT)
{
If (the message!=WM_RBUTTONDOWN)
WScroll +=(WORD) (SB_TOP - SB_LINEUP);
The else
WScroll +=(WORD) (SB_THUMBPOSITION - SB_LINEUP);
}
The else
{
If (message==WM_RBUTTONDOWN)
WScroll +=SB_PAGEUP - SB_LINEUP;

HArrow, bArrowTimed=SetTimer (SB_tmID,//GetWindowLong (hArrow, GWL_ID),
200, (TIMERPROC) ArrowTimerProc);
}
//send WM_VSCROLL to parent?
//nScrollCode=(int) LOWORD (wParam);//scroll bar value
//nPos=(short int) HIWORD (wParam);//scroll box position
//hwndScrollBar=(HWND) lParam;//handle to the scroll bar
HArrow, SendMessage (WM_VSCROLL MAKELONG (wScroll, GetWindowLong (hArrow, GWL_ID)),
HArrow) (LONG);
break;

CodePudding user response:

  • Related