| 网站首页 | 业界新闻 | 小组 | 威客 | 人才 | 下载频道 | 博客 | 代码贴 | 在线编程 | 编程论坛
欢迎加入我们,一同切磋技术
用户名:   
 
密 码:  
共有 691 人关注过本帖
标题:[求助]怎么获取当前桌面的图象
只看楼主 加入收藏
盛崖余
Rank: 1
等 级:新手上路
帖 子:54
专家分:0
注 册:2006-8-30
收藏
 问题点数:0 回复次数:6 
[求助]怎么获取当前桌面的图象
就相当与接图,但要用VB代码写
搜索更多相关主题的帖子: 图象 获取 代码 
2006-09-07 17:20
学习VB才2天
Rank: 5Rank: 5
等 级:贵宾
威 望:16
帖 子:1653
专家分:0
注 册:2006-5-4
收藏
得分:0 
Private Declare Function ReleaseDC Lib "user32" (ByVal hwnd As Long, ByVal hdc As Long) As Long
Private Declare Function OpenClipboard Lib "user32" (ByVal hwnd As Long) As Long
Private Declare Function EmptyClipboard Lib "user32" () As Long
Private Declare Function SetClipboardData Lib "user32" (ByVal wFormat As Long, ByVal hMem As Long) As Long
Private Declare Function SelectObject Lib "gdi32" (ByVal hdc As Long, ByVal hObject As Long) As Long
Private Declare Function DeleteDC Lib "gdi32" (ByVal hdc 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 Long
Private Declare Function CreateDC Lib "gdi32" Alias "CreateDCA" (ByVal lpDriverName As String, ByVal lpDeviceName As String, ByVal lpOutput As String, lpInitData As Long) As Long
Private Declare Function CreateCompatibleDC Lib "gdi32" (ByVal hdc As Long) As Long
Private Declare Function CreateCompatibleBitmap Lib "gdi32" (ByVal hdc As Long, ByVal nWidth As Long, ByVal nHeight As Long) As Long
Private Declare Function CloseClipboard Lib "user32" () As Long
函数:
Sub ScrnCap(Lt, Top, Rt, Bot)
rWidth = Rt - Lt
rHeight = Bot - Top
SourceDC = CreateDC("DISPLAY", 0, 0, 0)
DestDC = CreateCompatibleDC(SourceDC)
BHandle = CreateCompatibleBitmap(SourceDC, rWidth, rHeight)
SelectObject DestDC, BHandle
BitBlt DestDC, 0, 0, rWidth, rHeight, SourceDC, Lt, Top, &HCC0020
Wnd = Screen.ActiveForm.hwnd
OpenClipboard Wnd
EmptyClipboard
SetClipboardData 2, BHandle
CloseClipboard
DeleteDC DestDC
ReleaseDC DHandle, SourceDC
End Sub

[GLOW=255,DeepPink,3]我的免费网盘[/GLOW]
2006-09-07 17:55
盛崖余
Rank: 1
等 级:新手上路
帖 子:54
专家分:0
注 册:2006-8-30
收藏
得分:0 
能带点注释吗?好多看不懂?还是先谢谢了

不让生活磨灭我们的梦想!
2006-09-07 19:44
学习VB才2天
Rank: 5Rank: 5
等 级:贵宾
威 望:16
帖 子:1653
专家分:0
注 册:2006-5-4
收藏
得分:0 

Private Declare Function CreateCompatibleBitmap Lib "gdi32" (ByVal hdc As Long, ByVal nWidth As Long, ByVal nHeight As Long) As Long
Private Declare Function SelectObject Lib "gdi32" (ByVal hdc As Long, ByVal hObject As Long) As Long

Private Sub Form_Load()

Me.AutoRedraw = True
End Sub


Private sub command1_click()

Dim hBitmap As Integer
hBitmap = CreateCompatibleBitmap(Me.hdc, 0, 0)
SelectObject Me.hdc, hBitmap


end sub

这个简单......


[GLOW=255,DeepPink,3]我的免费网盘[/GLOW]
2006-09-12 17:05
del000
Rank: 1
等 级:新手上路
威 望:1
帖 子:79
专家分:0
注 册:2006-9-8
收藏
得分:0 
用API函数嘛,声明可以查的,函数的方法自己找找资料就可以了,《API资料》里有这个程序的,你参考一下吧~~~
2006-09-17 10:10
辉少
Rank: 1
等 级:新手上路
威 望:2
帖 子:147
专家分:7
注 册:2005-8-25
收藏
得分:0 
api 声名
bitblt
getdc
桌面dc 为 getdc(0)
用vbsrccopy 复制

辉少QQ:469781880 博客:http:///bbs/boke.asp?25189.index.html
2006-09-18 15:34
盛崖余
Rank: 1
等 级:新手上路
帖 子:54
专家分:0
注 册:2006-8-30
收藏
得分:0 
谢谢大家的帮忙现在问题决绝了~

不让生活磨灭我们的梦想!
2006-09-23 13:25
快速回复:[求助]怎么获取当前桌面的图象
数据加载中...
 
   



关于我们 | 广告合作 | 编程中国 | 清除Cookies | TOP | 手机版

编程中国 版权所有,并保留所有权利。
Powered by Discuz, Processed in 0.030954 second(s), 8 queries.
Copyright©2004-2024, BCCN.NET, All Rights Reserved