关于图象问题,望大家帮帮忙!!!

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) 那么该怎么做??????望大家帮帮忙!!!
...全文
69 5 打赏 收藏 转发到动态 举报
写回复
用AI写文章
5 条回复
切换为时间正序
请发表友善的回复…
发表回复
biku 2004-11-21
  • 打赏
  • 举报
回复
非常谢谢。
我下载来研究研究。
AprilSong 2004-11-21
  • 打赏
  • 举报
回复
啊~地址是这个……

http://www.21code.com/codebase/?pos=down&id=1627
AprilSong 2004-11-21
  • 打赏
  • 举报
回复
这个代码里面有个函数比较方便~

Function GetScreenSnapshot(Optional ByVal hwnd As Long) As IPictureDisp
biku 2004-11-21
  • 打赏
  • 举报
回复
难道没人能帮忙吗?
biku 2004-11-21
  • 打赏
  • 举报
回复
我无聊,我顶

809

社区成员

发帖
与我相关
我的任务
社区描述
VB 多媒体
社区管理员
  • 多媒体
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧