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



如何在vb中调用外部程序?


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


如何在vb中调用外部程序?
发表于:2007-08-02 17:29:44 楼主
如何在vb中调用外部程序(如:qq)
如果外部程序关闭,控制权如何能回到主程序得手中?
发表于:2007-08-02 17:56:591楼 得分:0
n=shell( "c:\qq2007\qq.exe ",1)


外部程序关闭,控制权如何能回到主程序

这个不太清楚了

      我也是菜鸟..
发表于:2007-08-02 18:06:282楼 得分:0
public   sub   shellwait(ccommandline   as   string,   appstyle   as   vbappwinstyle)

        dim   hshell   as   long
        dim   hproc   as   long
        dim   lexit   as   long
       
        hshell   =   shell(ccommandline,   appstyle)
       
        hproc   =   openprocess(process_query_information,   false,   hshell)
       
        do
       
        getexitcodeprocess   hproc,   lexit
       
        doevents
'         exit   do
       
       
        loop   while   lexit   =   still_active

end   sub
发表于:2007-08-02 20:07:263楼 得分:0
modest(塞北雪貂)     还在吗?
我也学vb不久~
能不能在你的代码后添加点注释呀?
这个调用用引用控件吗?
发表于:2007-08-02 20:09:324楼 得分:0
用api   抓   外部程序窗體的句柄   然後把外部窗體設為子窗體;
同理,可以抓外部程序的各個   子控件。
好象   有這幾個函數
findwindow;
postmessage;
setwindowpos;
sendmessagebystring;

public   declare   function   setwindowtext   lib   "user32 "   alias   "setwindowtexta "   (byval   hwnd   as   long,   byval   lpstring   as   string)   as   long

public   declare   function   getwindowtext   lib   "user32 "   alias   "getwindowtexta "   (byval   hwnd   as   long,   byval   lpstring   as   string,   byval   cch   as   long)   as   long
public   declare   function   getwindowtextlength   lib   "user32 "   alias   "getwindowtextlengtha "   (byval   hwnd   as   long)   as   long
public   declare   function   enumchildwindows   lib   "user32 "   (byval   hwndparent   as   long,   byval   lpenumfunc   as   long,   byval   lparam   as   long)   as   long
'public   declare   function   setfocus   lib   "user32 "   (byval   hwnd   as   long)   as   long
public   declare   function   enablewindow   lib   "user32 "   (byval   hwnd   as   long,   byval   fenable   as   long)   as   long
发表于:2007-08-02 20:16:045楼 得分:0
如果外部程序是qq

怎么抓句柄

能写出代码吗?

最好能写上注释!!

呵呵~
发表于:2007-08-02 20:51:506楼 得分:0
用winapi是shellEXECutea
发表于:2007-08-03 10:55:527楼 得分:0
自己根据代码到网上查说明,不要企望别人有注释


快速检索

最新资讯
热门点击