by adding these code to the case WM_PAINT:

hdc = BeginPaint(hWnd, &ps);
MoveToEx (hdc, 100, 100, NULL) ;
LineTo (hdc, 100, 200) ;
EndPaint(hWnd, &ps);


why can I adding them to the case WM_CREATE to realise it?

>>why can I adding them to the case WM_CREATE to realise it?

You want to do painting in the WM_CREATE event message? you can't do painting there because the window has not yet been created.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.