Using HDC to initialize data structure
I need to create a compatible DC and compute a font height. Both of these initialization steps require a handle to the device context called HDC.
Should I create them in InitInstance or WM_CREATE? In my case I create the dcImage and lfHeight in the InitInstance routine.
HDC hdc = GetDC(NULL);
dcImage = CreateCompatibleDC(hdc);
lfHeight = -MulDiv(12, GetDeviceCaps(hdc, LOGPIXELSY), 72);
On the WM_CREATE I finish the initialization procedure by using the SelectObject to finish the initilizaition of the device context called dcImage. It seems a bit artbitary because I could it either way.