您的位置:程序门 -> vb -> 基础类



大家帮看看程序到底错在那里?? 谢谢


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


大家帮看看程序到底错在那里?? 谢谢[已结贴,结贴人:shiguangxin]
发表于:2007-01-16 15:31:58 楼主
option   explicit
    private   declare   function   findwindowex   lib   "user32.dll "   alias   "findwindowexa "   (byval   hwnd1   as   long,   byval   hwnd2   as   long,   byval   lpsz1   as   string,   byval   lpsz2   as   string)   as   long
    private   declare   function   movewindow   lib   "user32.dll "   (byval   hwnd   as   long,   byval   x   as   long,   byval   y   as   long,   byval   nwidth   as   long,   byval   nheight   as   long,   byval   brepaint   as   long)   as   long
       
        private   type   rect
                left   as   long
                top   as   long
                right   as   long
                bottom   as   long
end   type

       
    private   sub   command1_click()
    dim   tdoc   as   mshtml.htmldocument
    dim   tiv   as   iviewobject
       
    dim   trc   as   rect
       
    dim   tow&,   toh&,   tsw&,   tsh&
       
    tow   =   webbrowser1.width
    toh   =   webbrowser1.height
       
    set   tdoc   =   webbrowser1.document
    set   tiv   =   tdoc
       
    tdoc.body.scroll   =   "no "
       
    tsw   =   tdoc.body.scrollwidth   +   4
    tsh   =   tdoc.body.scrollheight   +   4
       
    dim   thdl&
    thdl   =   getwebhwnd()
       
    movewindow   thdl,   0,   0,   tsw,   tsh,   0
       
    trc.right   =   tsw
    trc.bottom   =   tsh
       
    picture1.cls
    picture1.move   picture1.left,   picture1.top,   tsw,   tsh
     
*****************************************************************
 
    tiv.draw   dvaspect_content,   1,   byval   0,   byval   0,   _
                                    0&,   picture1.hdc,   trc,   trc,   byval   0,   byval   0
****************************************************************
这个地方出错了   :
提示:
byref   参数类型不符
****************************************************************
       
    tdoc.body.scroll   =   "yes "
    movewindow   thdl,   0,   0,   tow,   toh,   1
    savepicture   picture1.image,   "c:\web.bmp "
    picture1.cls
       
    end   sub
       
       
    private   sub   form_load()
    webbrowser1.navigate   "www.pconline.com.cn "
    end   sub
       
    private   sub   webbrowser1_newwindow2(ppdisp   as   object,   cancel   as   boolean)
    cancel   =   true
    end   sub
       
       
    private   function   getwebhwnd()   as   long
    dim   thdl&
    thdl   =   findwindowex(me.hwnd,   0,   "shell       embedding ",   " ")
    if   thdl   <>   0   then
                    thdl   =   findwindowex(thdl,   0,   "shell       docobject       view ",   " ")
                    if   thdl   <>   0   then
                                                    getwebhwnd   =   thdl
                    end   if
    end   if
    end   function

大家帮看看程序到底错在那里??   谢谢
发表于:2007-01-16 15:35:081楼 得分:0
这段程序要实现如下目的:
将   webbrower   控件中的网页保存为图片  

需要下载
http://www.mvps.org/emorcillo/download/vb6/tl_ole.zip
发表于:2007-01-16 20:24:152楼 得分:50
哈哈,我也出现过这样的问题,不过不知道能你能帮啊,在&前后都加一个空格试试
tiv.draw   dvaspect_content,   1,   byval   0,   byval   0,   _
                                    0   &   ,   picture1.hdc,   trc,   trc,   byval   0,   byval   0
发表于:2007-01-17 08:36:113楼 得分:0
不行呀
555   不知道错在那里了
发表于:2007-01-17 09:49:544楼 得分:0
555   分不够可以一再加呀
发表于:2007-01-17 11:35:205楼 得分:0
霍霍   终于弄明白了
问题出在  
private   type   rect
                left   as   long
                top   as   long
                right   as   long
                bottom   as   long
end   type

啊啊   把它删了就好了


快速检索

最新资讯
热门点击