February 15th, 2013, 06:30 PM
Getting the DPI information for the current display
I am new to C# and I am having problems getting some snippets of code to build. I am using VS2010 and am trying to use GetDeviceCaps or CreateGraphics to get the DPI of my monitor. This is the GetDeviceCaps code that I have.
HDC screen = GetDC(NULL);
double hDPI = GetDeviceCaps(screen,LOGPIXELSX);
double vDPI = GetDeviceCaps(screen,LOGPIXELSY);
Do I need to add a resource or library or something else so the compiler recognizes SetProcessDPIAware, GetDC, HDC, GetDeviceCaps, and ReleaseDC?
Click Here to Expand Forum to Full Width
This is a Codeguru.com survey!