I have reduced my code to try and simplify my problem.
This snippet from my windows proceedure draws to the screen as expected.
Code:
case WM_PAINT:
{
hDC = BeginPaint( hwnd, &ps );
HPEN hPen = CreatePen(PS_SOLID, 1, RGB(255,0,0));
SelectObject( hDC, hPen );
MoveToEx(hDC,52,52,NULL);
LineTo(hDC,100,200);
DeleteObject( SelectObject( hDC, GetStockObject( BLACK_PEN ) ) );
ReleaseDC( hwnd, hDC );
EndPaint( hwnd, &ps );
return 0;
}
When I move my code to another function it doesn't draw anything. Here is my most recent attempt to get it up and running:
Code:
void DrawSection(HWND hwnd)
{
HDC hDC;
hDC = GetDC( hwnd);
HPEN hPen = CreatePen(PS_SOLID, 1, RGB(255,0,0));
SelectObject( hDC, hPen );
MoveToEx(hDC,0,0,NULL);
LineTo(hDC,100,200);
DeleteObject( SelectObject( hDC, GetStockObject( BLACK_PEN ) ) );
ReleaseDC( hwnd, hDC );
// UpdateWindow(hwnd);
// InvalidateRect (hwnd, NULL, TRUE);
// SendMessage(hwnd,WM_PAINT,0,0);
return;
}