Type a page name and press Enter. You'll jump to the page if it exists, or you can create it if it doesn't.
To create a page in a module other than user32, prefix the name with the module name and a period.
Declare Function GetWindowDC Lib "user32" (ByVal hwnd As IntPtr) As IntPtr
User-Defined Types:
None.
Notes:
None.
Tips & Tricks:
Please add some!
Sample Code:
Private Declare Auto Function BitBlt Lib "gdi32.dll" (ByVal hdcDest As IntPtr, ByVal nXDest As Integer, ByVal _
nYDest As Integer, ByVal nWidth As Integer, ByVal nHeight As Integer, ByVal hdcSrc As IntPtr, ByVal nXSrc _
As Integer, ByVal nYSrc As Integer, ByVal dwRop As System.Int32) As Boolean
Private Const SRCCOPY As Integer = &HCC0020
Declare Function GetWindowDC Lib "user32" (ByVal hwnd As IntPtr) As IntPtr
' Get an image of the form plus its decoration
' (borders, title bar, etc).
Private Function GetDecoratedFormImage() As Bitmap
' Get this form's Graphics object.
Dim MyGrph As Graphics = Me.CreateGraphics
' Make a Bitmap to hold the image.
Dim TempBMP As New Bitmap(Me.Width, Me.Height, MyGrph)
Dim MyGrphBmp As Graphics = MyGrph.FromImage(TempBMP)
Dim MyGrphBmpHdc As IntPtr = MyGrphBmp.GetHdc
' Get the form's hDC. We must do this after
' creating the new Bitmap, which uses me_gr.
Dim MyGrphHdc As IntPtr = GetWindowDC(Me.Handle)
' BitBlt the form's image onto the Bitmap.
BitBlt(MyGrphBmpHdc, 0, 0, Me.Width, Me.Height, MyGrphHdc, 0, 0, SRCCOPY)
MyGrphBmp.ReleaseHdc(MyGrphBmpHdc)
' Return the result.
Return TempBMP
End Function
Alternative Managed API:
Do you know one? Please contribute it!
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).