Juz a stupid Q, and take a look the code shown below:
Why there is a need to restore the old pen object into the device Context (DC)? What will happen if I does not restore it?Code:Dim hdc As Long
Dim hPen As Long
Dim hOldPen As Long
Dim pt As POINTAPI
hdc = GetDC(Form1.hwnd)
hPen = CreatePen(PS_SOLID, RGB(0, 255, 255))
hOldPen = SelectObject(hdc, hPen)
Polyline hdc, pt(0), 5
SelectObject hdc, hOldPen
DeleteObject hPen
ReleaseDC Form1.hwnd, hdc
