关于图象问题,望大家帮帮忙!!!
biku 2004-11-20 10:01:25 Private Declare Function GetCursor Lib "user32" () 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 Long
Private Declare Function GetDC Lib "user32" (ByVal hwnd As Long) As Long
Private Declare Function GetCursorPos Lib "user32" (lpPoint As POINTAPI) As Long
Private Declare Function DrawIcon Lib "user32" (ByVal hdc As Long, ByVal x As Long, ByVal y As Long, ByVal hIcon As Long) As Long
Private Declare Function ReleaseDC Lib "user32" (ByVal hwnd As Long, ByVal hdc As Long) As Long
Private Type POINTAPI
x As Long
y As Long
End Type
Private Sub GetPic()
Dim hdc As Long
Dim sw As Integer
Dim sh As Integer
Dim CurPos As POINTAPI
Dim Cur As Long
hdc = GetDC(0)
GetCursorPos CurPos
Cur = GetCursor
sw = Screen.Width / Screen.TwipsPerPixelX
sh = Screen.Height / Screen.TwipsPerPixelY
BitBlt Picture1.hdc, 0, 0, sw, sh, hdc, 0, 0, vbSrcCopy
ReleaseDC 0, hdc
End Sub
Private Sub Timer1_Timer()
Call GetPic
End Sub
上面是一个实时捕捉桌面的程序,其中用了PictureBox控件。
请问大家,能不能不用控件,而用变量代替控件呢?比如说Dim tpic As New Stdpicture,然后实时将桌面图象“传”给tpic 。(不要用Dim tpic As PictureBox) 那么该怎么做??????望大家帮帮忙!!!