您的位置:程序门 -> vb ->



跪求一个能够抓屏幕图的工具,越简单越好,最好带有源代码。。。谢谢啊。。


[收藏此页] [打印本页]选择字色:背景色:字体:[][][]


跪求一个能够抓屏幕图的工具,越简单越好,最好带有源代码。。。谢谢啊。。
发表于:2007-05-12 22:03:46 楼主
高高高高手门   有的话   就发到   zpp2025@yahoo.com.cn
发表于:2007-05-12 22:07:161楼 得分:0
只用一个api就可以完成啦。叫bitb什么来的
发表于:2007-05-12 22:10:552楼 得分:0
就是它了bitblt   ()
发表于:2007-05-12 22:14:323楼 得分:0
我不会   vb的   你能不能把代码帮我写出来啊
非常感谢啊,,最好能够调试成功,并且截出来后能够保存。谢谢拉
发表于:2007-05-12 22:15:544楼 得分:0
我需要源代码啊,,   就是能把抓的图片给保存到指定地方就行拉。。谢谢拉。。非常感谢拉。。
谢谢啊
发表于:2007-05-12 22:28:095楼 得分:0
看到这样的题目就没有兴趣。
发表于:2007-05-17 23:23:296楼 得分:0
'------------------------------------------------------------------------------


option   explicit

public   type   bitmapfileheader
                bftype(0   to   1)   as   byte
                bfsize   as   long
                bfreserved1   as   integer
                bfreserved2   as   integer
                bfoffbits   as   long
end   type

public   type   bitmapinfoheader   '40   bytes
                bisize   as   long
                biwidth   as   long
                biheight   as   long
                biplanes   as   integer
                bibitcount   as   integer
                bicompression   as   long
                bisizeimage   as   long
                bixpelspermeter   as   long
                biypelspermeter   as   long
                biclrused   as   long
                biclrimportant   as   long
end   type
public   type   rgbquad
                rgbblue   as   byte
                rgbgreen   as   byte
                rgbred   as   byte
                rgbreserved   as   byte
end   type
public   type   bitmapinfo
                bmiheader   as   bitmapinfoheader
                bmicolors   as   rgbquad
end   type

declare   function   getdc   lib   "user32 "   (byval   hwnd   as   long)   as   long
declare   function   createcompatibledc   lib   "gdi32 "   (byval   hdc   as   long)   as   long
declare   function   createdibsection   lib   "gdi32 "   (byval   hdc   as   long,   pbitmapinfo   as   bitmapinfo,   byval   un   as   long,   lplpvoid   as   long,   byval   handle   as   long,   byval   dw   as   long)   as   long
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
declare   function   selectobject   lib   "gdi32 "   (byval   hdc   as   long,   byval   hobject   as   long)   as   long
declare   function   deletedc   lib   "gdi32 "   (byval   hdc   as   long)   as   long
declare   function   deleteobject   lib   "gdi32 "   (byval   hobject   as   long)   as   long
public   declare   sub   copymemory   lib   "kernel32 "   alias   "rtlmovememory "   (byval   destination   as   long,   byval   source   as   long,   byval   length   as   long)

public   const   dib_rgb_colors   =   0   '     color   table   in   rgbs
public   const   srccopy   =   &hcc0020   '   (dword)   dest   =   source


'----------------------------
'作者:money
'e-mail:2258773@163.com

'涵数功能:拷屏,保存为bmp文件
'成功返回真
'----------------------------
public   function   copyscreentobmp(byval   szfile   as   string)   as   boolean
    dim   w   as   long,   h   as   long
    dim   scrdc   as   long
    dim   dib   as   long,   m_dc   as   long
    dim   bmpinfo   as   bitmapinfo
    dim   bmpfilehead   as   bitmapfileheader
    dim   pdata   as   long
    dim   buff()   as   byte
    dim   old   as   long
    dim   l   as   long
        '取屏幕   高宽
        w   =   screen.width   \   15
        h   =   screen.height   \   15
        '准备内存dc
        m_dc   =   createcompatibledc(0&)
        if   m_dc   =   0   then
                copyscreentobmp   =   false
                exit   function
        end   if
        '填充dib的bmp结构
        with   bmpinfo.bmiheader
                .bibitcount   =   24
                .biplanes   =   1
                .biheight   =   h
                .biwidth   =   w
                .bisize   =   40   '本结构长度
        end   with
       
        dib   =   createdibsection(m_dc,   bmpinfo,   dib_rgb_colors,   pdata,   0,   0)
        '分配内存
        if   dib   =   0   then
                copyscreentobmp   =   false
                exit   function
        end   if
       
        old   =   selectobject(m_dc,   dib)
        '拷屏
        scrdc   =   getdc(0)
        bitblt   m_dc,   0,   0,   w,   h,   scrdc,   0,   0,   srccopy
       
        '分配内存
        l   =   w   *   h   *   3
        '补足4的倍数
        if   l   mod   4   <>   0   then   l   =   l   +   (4   -   l   mod   4)
        redim   buff(1   to   l)   as   byte
       
       
        '取像素数据
        copymemory   varptr(buff(1)),   pdata,   l
       
        '释放资源
        selectobject   m_dc,   old
        deleteobject   dib
        deletedc   m_dc
       
        '填充bmpfile
        with   bmpfilehead
                'bm标志
                .bftype(0)   =   asc( "b "):   .bftype(1)   =   asc( "m ")
                .bfsize   =   len(bmpfilehead)   +   len(bmpinfo)   +   l
                .bfoffbits   =   len(bmpfilehead)   +   len(bmpinfo)
        end   with
       
        '写入文件
       
        l   =   freefile()
        open   szfile   for   binary   as   l
        '写入文件头
        put   l,   1,   bmpfilehead
        put   l,   ,   bmpinfo
        '写入实际像素
        put   l,   ,   buff()
        close   l
       
        copyscreentobmp   =   true

end   function

'---------------------------------------------

例程
option   explicit

private   sub   command1_click()
    dim   ok   as   boolean
        ok   =   copyscreentobmp( "c:\test.bmp ")
        if   ok   then
                me.picture   =   loadpicture( "c:\test.bmp ")
        else
                msgbox   "cao,拷屏失败了~ "
        end   if
end   sub

'------------------------

结贴给分吧.


求vb6兼职

发表于:2007-05-22 18:39:457楼 得分:0
好代码,收藏了!!!!
发表于:2007-05-28 16:54:328楼 得分:0
这里有截屏的源码:

http://www.egooglet.com/static_html/200511092129358495admin.html
发表于:2007-05-28 17:33:289楼 得分:0
http://download.csdn.net/source/161571
热键ctrl+alt+s剪切屏幕,和qq的功能一样。
发表于:2007-05-28 18:33:0610楼 得分:0
我也要收藏


快速检索

最新资讯
热门点击