找回密码
 加入
搜索
查看: 2206|回复: 3

[系统综合] SCRIPT控件SUB如何更改¥

[复制链接]
发表于 2009-10-7 11:34:24 | 显示全部楼层 |阅读模式
本帖最后由 dhlhmgc 于 2011-1-26 22:43 编辑

Dim $b = 3
Dim $strCode = StringReplace("sub Main(b)| b=b*b |End sub","|", @CRLF )
Dim $msc = ObjCreate("ScriptControl")
With $msc
        .Language = "VBScript"
        .AddCode ($strCode)
        .Run ("Main",$b)
EndWith

MsgBox ( 0,"提示", $b )
;==========$b 为什么不等于9
发表于 2009-10-7 23:43:24 | 显示全部楼层
不太懂vbs 不知道sub能不能有返回值 byref好像也不行 就用函数好了


Dim $b = 3
Dim $strCode = StringReplace("Function Main(b)| Main=b*b |End Function", "|", @CRLF)
Dim $msc = ObjCreate("ScriptControl")
With $msc
        .Language = "VBScript"
        .AddCode($strCode)
        $b = .Run("Main", $b)
EndWith

MsgBox(0, "提示", $b)
发表于 2009-10-9 23:29:35 | 显示全部楼层
Sub的意思就是没有返回值的函数声明
Function是一定有返回值的
发表于 2009-10-10 11:02:20 | 显示全部楼层
那sub的 byref是怎么表达的?
您需要登录后才可以回帖 登录 | 加入

本版积分规则

QQ|手机版|小黑屋|AUTOIT CN ( 鲁ICP备19019924号-1 )谷歌 百度

GMT+8, 2024-5-9 19:43 , Processed in 0.097884 second(s), 21 queries .

Powered by Discuz! X3.5 Licensed

© 2001-2024 Discuz! Team.

快速回复 返回顶部 返回列表