Getting the DPI information for the current display
CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 2 of 2

Thread: Getting the DPI information for the current display

  1. #1
    Join Date
    Feb 2013
    Posts
    1

    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.

    {
    SetProcessDPIAware();
    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
    Location
    Rocket City
    Posts
    219

    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

This is a CodeGuru survey question.


Featured


HTML5 Development Center