Jump to content

  • Log In with Google      Sign In   
  • Create Account


#Actualnoatom

Posted 20 October 2012 - 04:09 AM

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 testtest.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?

#1noatom

Posted 20 October 2012 - 04:06 AM

I'm trying to use the following:

a rect structure: http://msdn.microsoft.com/en-us/library/windows/desktop/dd162897(v=vs.85).aspx
and the function for a rect structure called PtInRect: http://msdn.microsoft.com/en-us/library/windows/desktop/dd162882(v=vs.85).aspx

So I have the following code:

[source lang="cpp"]RECT testtest.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?

PARTNERS