I dont understand why this doesn't work. On message WM_LBUTTONDOWN, the coordinates of the pointer are stored. then on WM_MOUSEMOVE, if the left button is down, i want it to draw an ellipse with the original points and the new points that are where the mouse is now. But nothing happens when I debug. Here is my WindowProc
LRESULT CALLBACK WindowProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
{
PAINTSTRUCT ps;
HDC hdc;
switch (uMsg)
{
case WM_DESTROY:
{
DestroyWindow(hwnd);
PostQuitMessage(0);
break;
}
case WM_PAINT:
{
hdc = BeginPaint(hwnd, &ps);
EndPaint(hwnd, &ps);
break;
}
case WM_LBUTTONDOWN:
{
pnt.x = GET_X_LPARAM(lParam);
pnt.y = GET_Y_LPARAM(lParam);
break;
}
case WM_MOUSEMOVE:
{
if(wParam == MK_LBUTTON)
{
hdc = BeginPaint(hwnd, &ps);
Ellipse(hdc, pnt.x, pnt.y, GET_X_LPARAM(lParam), GET_Y_LPARAM(lParam)); // nothing happens
EndPaint(hwnd, &ps);
}
break;
}
return 0;
}
return DefWindowProc(hwnd, uMsg, wParam, lParam);
}