GDI leak



Hello,

For quite some time, I have been using a function that I found somewhere on the 'net.
It looks like this:
Public Function CreateMyFont(nSize As Integer, nDegrees As Long) As Long
' 'Create a specified font
CreateMyFont = CreateFont(-MulDiv(nSize, GetDeviceCaps(GetDC(0), LOGPIXELSY), 72), 0, nDegrees * 10, 0, FW_NORMAL, False, False, False, DEFAULT_CHARSET, OUT_DEFAULT_PRECIS, CLIP_DEFAULT_PRECIS, PROOF_QUALITY, DEFAULT_PITCH, "MS Sans Serif")
End Function

Now, I understand that it causes GDI leaks.
Occasional use wasn't so harmful, but I started using it in a frequently called paint routine, and then things got nasty.

As I understand it, one must release the DC after calling GetDC.
But what is the correct hWnd parameter for ReleaseDC in this case?
(After calling GetDC with 0 as parameter...)

Tia,

Johan Stäck
Skellefteå
Sweden
.