Public Declare Function GetDesktopWindow Lib "user32" Alias "GetDesktopWindow" () As IntPtr
Public Declare Function GetDCEx Lib "user32" Alias "GetDCEx" (ByVal hwnd As IntPtr, ByVal hrgnclip As IntPtr, ByVal fdwOptions As Integer) As IntPtr
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
Dim desk As Integer = GetDesktopWindow()
Dim deskDC As Integer = GetDCEx(desk, IntPtr.Zero, &H403)
Dim g As Graphics = Graphics.FromHdc(deskDC)
g.FillEllipse(SystemBrushes.ControlText, 0, 0, 100, 100)
g.Dispose()
End Sub
Public Declare Function GetDesktopWindow Lib "user32" Alias "GetDesktopWindow" () As Integer
Public Declare Function GetDCEx Lib "user32" Alias "GetDCEx" (ByVal hwnd As Integer, ByVal hrgnclip As Integer, ByVal fdwOptions As Integer) As Integer
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
Dim desk As Integer = GetDesktopWindow()
Dim deskDC As Integer = GetDCEx(desk, IntPtr.Zero, 1027)