Original Post
I'm trying to use the following:
a rect structure: Click to acces page
and the function for a rect structure called PtInRect: Click to acces page
So I have the following code:
[source lang="cpp"]RECT test
test.bottom = 0;
test.top = height_of_window;
test.right = width_of_window / 2;
test.left = -width_of_window / 2;
void OnMouseDown(WPARAM btnState, int x, int y)
{
mLastMousePos.x = x;
mLastMousePos.y = y;
SetCapture(mhMainWnd);
POINT xa;
xa.x = mLastMousePos.x;
xa.y = mLastMousePos.y;
if(PtInRect(&test,xa))
MessageBox(NULL,L"FOUND",L"FOUND",NULL);
}[/source]
First: I tested the mousedown function,when a button just clicks,it works properly!
As you can see I created a rectangle half of the height of the screen,and full width of the screen.The above code should make any click in the upper part of the screen show a messagebox,however,this doesn't happent!
What am I doing wrong?
a rect structure: Click to acces page
and the function for a rect structure called PtInRect: Click to acces page
So I have the following code:
[source lang="cpp"]RECT test
test.bottom = 0;
test.top = height_of_window;
test.right = width_of_window / 2;
test.left = -width_of_window / 2;
void OnMouseDown(WPARAM btnState, int x, int y)
{
mLastMousePos.x = x;
mLastMousePos.y = y;
SetCapture(mhMainWnd);
POINT xa;
xa.x = mLastMousePos.x;
xa.y = mLastMousePos.y;
if(PtInRect(&test,xa))
MessageBox(NULL,L"FOUND",L"FOUND",NULL);
}[/source]
First: I tested the mousedown function,when a button just clicks,it works properly!
As you can see I created a rectangle half of the height of the screen,and full width of the screen.The above code should make any click in the upper part of the screen show a messagebox,however,this doesn't happent!
What am I doing wrong?