類似于QQ截圖時自動選取視窗,不知道BitBlt能否用于螢屏場景的影像復制。代碼如下
Private Declare Function GetDC Lib "user32" (ByVal hwnd As Long) As Long
Private Declare Function ReleaseDC Lib "user32" (ByVal hwnd As Long, ByVal hdc As Long) As Long
Private Declare Function GetWindowDC Lib "user32" (ByVal hwnd As Long) As Long
Private Declare Function GetCursorPos Lib "user32" (lpPoint As POINTAPI) As Long
Private Declare Function WindowFromPoint Lib "user32" (ByVal xPoint As Long, ByVal yPoint As Long) As Long
Private Declare Function GetWindowRect Lib "user32" (ByVal hwnd As Long, lpRect As RECT) 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, ByValhSrcDC As Long, ByVal xSrc As Long, ByVal ySrc As Long, ByVal dwRop As Long) As Long
Private Declare Function GetDesktopWindow Lib "user32" () As Long
Private Type POINTAPI
x As Long
y As Long
End Type
Private Type RECT
Left As Long
Top As Long
Right As Long
Bottom As Long
End Type
Private Sub Timer1_Timer()
Dim xy As POINTAPI
Dim R As RECT
GetCursorPos xy
jb = WindowFromPoint(xy.x, xy.y)
GetWindowRect jb, R
dc = GetWindowDC(jb)
dc1 = GetWindowDC(GetDesktopWindow)
BitBlt dc, 0, 0, R.Right - R.Left, R.Bottom - R.Top, dc1, 0, 0, vbSrcCopy '復制繪圖
ReleaseDC jb, dc '釋放
ReleaseDC GetDesktopWindow, dc1 '釋放
End Sub
uj5u.com熱心網友回復:
看看這個,或許對你有幫助http://blog.csdn.net/worldy/article/details/7381106
uj5u.com熱心網友回復:
我只想在螢屏上繪制出來,謝謝uj5u.com熱心網友回復:
哪個哪里是在螢屏上繪制的啊,命名是一個表單截圖后全屏展示而已。參考下面這個資源,我用vb做的兩種方案:
http://download.csdn.net/detail/sysdzw/3191717
轉載請註明出處,本文鏈接:https://www.uj5u.com/gongcheng/155959.html
標籤:API
上一篇:仿騰訊扣扣界面 VB原始碼
