Search
Module:
Directory

   Desktop Functions:

   Smart Device Functions:


Show Recent Changes
Subscribe (RSS)
Misc. Pages
Comments
FAQ
Helpful Tools
Playground
Suggested Reading
Website TODO List
Download Visual Studio Add-In

getdevicecaps (gdi32)
 
.
Summary

C# Signature:

[DllImport("gdi32.dll")]
static extern int GetDeviceCaps(IntPtr hdc, int nIndex);

VB.NET Signature:

<DllImport("gdi32.dll")> _
Public Shared Function GetDeviceCaps(ByVal hDC As IntPtr, ByVal nIndex As Integer) As Integer
End Function

User-Defined Types:

You can use the following enumeration for passing in as nIndex:

  public enum DeviceCap
  {
      DRIVERVERSION = 0,
      TECHNOLOGY    = 2,
      HORZSIZE      = 4,
      VERTSIZE      = 6,
      HORZRES       = 8,
      VERTRES       = 10,
      BITSPIXEL     = 12,
      PLANES    = 14,
      NUMBRUSHES    = 16,
      NUMPENS       = 18,
      NUMMARKERS    = 20,
      NUMFONTS      = 22,
      NUMCOLORS     = 24,
      PDEVICESIZE   = 26,
      CURVECAPS     = 28,
      LINECAPS      = 30,
      POLYGONALCAPS = 32,
      TEXTCAPS      = 34,
      CLIPCAPS      = 36,
      RASTERCAPS    = 38,
      ASPECTX       = 40,
      ASPECTY       = 42,
      ASPECTXY      = 44,

      LOGPIXELSX    = 88,
      LOGPIXELSY    = 90,

      SIZEPALETTE  = 104,
      NUMRESERVED  = 106,
      COLORRES     = 108,

      // Printing related DeviceCaps. These replace the appropriate Escapes
      PHYSICALWIDTH   = 110,
      PHYSICALHEIGHT  = 111,
      PHYSICALOFFSETX = 112,
      PHYSICALOFFSETY = 113,
      SCALINGFACTORX  = 114,
      SCALINGFACTORY  = 115
  }

Notes:

None.

Tips & Tricks:

Please add some!

Sample Code:

Please add some!

Alternative Managed API:

System.Windows.Forms.Screen.PrimaryScreen (Matt M Jacobsen)

Documentation

Please edit this page!

Do you have...

  • helpful tips or sample code to share for using this API in managed code?
  • corrections to the existing content?
  • variations of the signature you want to share?
  • additional languages you want to include?

Select "Edit This Page" on the right hand toolbar and edit it! Or add new pages containing supporting types needed for this API (structures, delegates, and more).

 
Access PInvoke.net directly from VS:
Terms of Use
Find References
Show Printable Version
Revisions