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



怎么读取外程序的listbox的内容 在线


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


怎么读取外程序的listbox的内容 在线[已结贴,结贴人:noooon]
发表于:2007-04-21 14:52:50 楼主
怎么读取外程序的listbox的内容   在线,先谢谢了
发表于:2007-04-21 17:25:401楼 得分:0
好像不行
发表于:2007-04-21 17:38:382楼 得分:0
没有人知道吗?
发表于:2007-04-21 19:33:283楼 得分:20
在vb里面如何得到外部程序的listbox内容

以下代码掩饰在得知两个listbox句柄时,把其中一个里面的内容复制到另外一个里面

duplicatelistbox参数解释:
sourcehwnd=源listbox句柄(hwnd)
targethwnd=目标listbox句柄(hwnd)
appendmode=是否对源listbox的content进行校验,true就可以了

========================================================================
private   declare   function   sendmessage   lib   "user32 "   alias   "sendmessagea "   (byval   _
        hwnd   as   long,   byval   wmsg   as   long,   byval   wparam   as   long,   _
        lparam   as   any)   as   long
private   declare   function   lockwindowupdate   lib   "user32 "   (byval   hwndlock   as   long)   _
        as   long
     
const   lb_resetcontent   =   &h184
const   lb_getcount   =   &h18b
const   lb_gettext   =   &h189
const   lb_addstring   =   &h180
const   lb_getitemdata   =   &h199
const   lb_setitemdata   =   &h19a


sub   duplicatelistbox(sourcehwnd   as   long,   targethwnd   as   long,   _
        optional   appendmode   as   boolean)
        dim   index   as   long
        dim   itmdata   as   long
        dim   numitems   as   long
        dim   sitemtext   as   string
       
        '   prepare   the   receiving   buffer
        sitemtext   =   space$(512)
       
        '   temporarily   prevent   updating
        lockwindowupdate   targethwnd
       
        '   reset   target   contents,   if   not   in   append   mode
        if   not   appendmode   then
                sendmessage   targethwnd,   lb_resetcontent,   0,   byval   0&
        end   if

        '   get   the   number   of   items   in   the   source   list
        numitems   =   sendmessage(sourcehwnd,   lb_getcount,   0&,   byval   0&)
       
        for   index   =   0   to   numitems   -   1
                '   get   the   item   text
                sendmessage   sourcehwnd,   lb_gettext,   index,   byval   sitemtext
                '   get   the   item   data
                itmdata   =   sendmessage(sourcehwnd,   lb_getitemdata,   index,   byval   0&)
                '   add   the   item   text   to   the   target   list
                sendmessage   targethwnd,   lb_addstring,   0&,   byval   sitemtext
                '   add   the   item   data   to   the   target   list
                sendmessage   targethwnd,   lb_setitemdata,   index,   byval   itmdata
        next
       
        '   allow   redrawing
        lockwindowupdate   0
       
end   sub

调用
duplicatelistbox   sourcehwnd,   targethwnd,   true


发表于:2007-04-21 21:07:574楼 得分:0
rainstormmaster(暴风雨   v2.0)   如果listview该如何取呢   谢谢了
发表于:2007-04-21 21:15:095楼 得分:0
//如果listview该如何取呢   谢谢了

listview就要麻烦一些了,不过你可以利用google找到代码
发表于:2007-04-21 21:16:166楼 得分:0
sendmessage
发表于:2007-04-21 21:21:117楼 得分:0
谢谢已经查到。


快速检索

最新资讯
热门点击