GetDC (user32)
Last changed: -189.172.115.110

.
Summary

C# Signature:

[DllImport("user32.dll")]
static extern IntPtr GetDC(HandleRef hWnd);

User-Defined Types:

None.

Notes:

Given the level of transparency provided by the System.Drawing.Graphics class, it is probably better to use that instead of GetDC.

Remember, if you use GetDC manually without the Graphics class, you must call ReleaseDC.

This method can also be declared using an IntPtr instead of a HandleRef. Using a HandleRef ensures that the window will not be destroyed/GCed while the function is executing.

Tips & Tricks:

Please add some!

Sample Code:

Please add some!

Alternative Managed API:

System.Drawing.Graphics.FromHwnd(IntPtr hwnd)

Documentation
GetDC on MSDN