Private Declare Function GetDesktopWindow Lib "user32" () As Long Private Declare Function GetDC Lib "user32" (ByVal hwnd As Long) As Long Private Declare Function BitBlt Lib "gdi32" (ByVal hDestDC As Long, ByVal x As Long, ByVal y As Long, ByVal nWidth As Long, ByVal nHeight As Long, ByVal hSrcDC As Long, ByVal xSrc As Long, ByVal ySrc As Long, ByVal dwRop As Long) As LongPrivate Sub Form_Load() Dim lDesktop&, hDC& Me.AutoRedraw = True Me.ScaleMode = 1 lDesktop = GetDesktopWindow() '取得桌面窗口 hDC = GetDC(lDesktop) '取得桌面窗口的设备场景 BitBlt Me.hDC, 0, 0, Screen.Width, Screen.Height, hDC, 0, 0, vbSrcCopy '将桌面图象绘制到窗体 End Sub
Private Declare Function GetDC Lib "user32" (ByVal hwnd As Long) As Long
Private Declare Function BitBlt Lib "gdi32" (ByVal hDestDC As Long, ByVal x As Long, ByVal y As Long, ByVal nWidth As Long, ByVal nHeight As Long, ByVal hSrcDC As Long, ByVal xSrc As Long, ByVal ySrc As Long, ByVal dwRop As Long) As LongPrivate Sub Form_Load()
Dim lDesktop&, hDC&
Me.AutoRedraw = True
Me.ScaleMode = 1
lDesktop = GetDesktopWindow() '取得桌面窗口
hDC = GetDC(lDesktop) '取得桌面窗口的设备场景
BitBlt Me.hDC, 0, 0, Screen.Width, Screen.Height, hDC, 0, 0, vbSrcCopy '将桌面图象绘制到窗体
End Sub