if (printerDC.GetHDC())
{
printerWidth = ::GetDeviceCaps((HDC) printerDC.GetHDC(), HORZSIZE);
printerHeight = ::GetDeviceCaps((HDC) printerDC.GetHDC(), VERTSIZE);
printerXRes = ::GetDeviceCaps((HDC) printerDC.GetHDC(), HORZRES);
printerYRes = ::GetDeviceCaps((HDC) printerDC.GetHDC(), VERTRES);
if (printerDC.GetHDC())
{
printerWidth = ::GetDeviceCaps((HDC) printerDC.GetHDC(), HORZSIZE);
printerHeight = ::GetDeviceCaps((HDC) printerDC.GetHDC(), VERTSIZE);
printerXRes = ::GetDeviceCaps((HDC) printerDC.GetHDC(), HORZRES);
printerYRes = ::GetDeviceCaps((HDC) printerDC.GetHDC(), VERTRES);