CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 2 of 2
  1. #1
    Join Date
    Feb 2013

    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);
    ReleaseDC(NULL, screen);

    Do I need to add a resource or library or something else so the compiler recognizes SetProcessDPIAware, GetDC, HDC, GetDeviceCaps, and ReleaseDC?

  2. #2
    Join Date
    Oct 2004
    Rocket City

    Re: Getting the DPI information for the current display

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Windows Mobile Development Center

Click Here to Expand Forum to Full Width

On-Demand Webinars (sponsored)

We have made updates to our Privacy Policy to reflect the implementation of the General Data Protection Regulation.