yeah i understand that WM_SIZE is only called when you try to resize the window and WM_Create is called when the window is created....
here is my message loop...
Code:
switch(msg)
{
case WM_SIZE:
csizex = LOWORD(lParam);
csizey = HIWORD(lParam);
break;
case WM_LBUTTONDOWN:
{
int mousex = LOWORD(lParam);
int mousey = HIWORD(lParam);
region = 0;
if (mousex < (csizex/2) && mousey <(csizey/2))
region = 1;
if (mousex > (csizex/2) && mousey <(csizey/2))
region = 2;
if (mousex < (csizex/2) && mousey >(csizey/2))
region = 3;
if (mousex > (csizex/2) && mousey >(csizey/2))
region = 4;
if (region>0) sprintf(regionbuff,"You clicked in Region %i",region);
else sprintf(regionbuff,"You clicked on a line!!!");
MessageBox(hwnd,regionbuff,"Region clicked...",MB_OK);
}
break;
case WM_CLOSE:
DestroyWindow(hwnd);
break;
case WM_DESTROY:
PostQuitMessage(0);
break;
case WM_PAINT:
// vertical line
hdc = BeginPaint (hwnd, &ps) ;
MoveToEx (hdc, (csizex/2), 0, NULL) ;
LineTo (hdc, (csizex/2), csizey ) ;
// horizontal line
MoveToEx (hdc, 0, (csizey/2), NULL) ;
LineTo (hdc, (csizex), (csizey/2) ) ;
default:
return DefWindowProc(hwnd, msg, wParam, lParam);
}
Now if my window has no resize button, how is it that csizex and csizey have values in them from wm_size? my understanding is that WM_SIZE will never be called in my program and therefore should have errors when the mouse button is clicked.
Basically this program draws to lines to divide the screen into 4 parts and then i detect which part is clicked in.
And another quick question, if i make a window 800x600 then that is the size of the whole window and not just the client area of the window right?
Thanks for your time
Werdy666