VB程序中使用脚本支持
正在开发小秘书系统并不断提高其智能水平,其中用到的是脚本支持的技术
虽然这部分不属于初学者使用,然而有些人想学这个东东,这里就发~~~布出去吧!
新建一个标准exe工程(Standard EXE);
"工程"(Project)-->"部件"(Components)
选定"Microsoft Script Control 1.0" ,位置是C:\WINDOWS\system32\msscript.ocx
添加控件到工程,个人爱好我命名mscScript
然后添加一些控件,得到如下图的界面,然后是下面这些函数,过程:
Private Sub Form_Load()
mscScript.AddObject "frmMain", frmMain
mscScript.AddObject "objScript", objScript
End Sub
'---------------------------------------
'vbClass Moudle clsFunction
'---------------------------------------
Public Function strRun(ByVal str As String) As String
Dim strName As String
Dim strExpress() As String
strName = Left(str, InStr(str, " ") - 1)
strExpress = Split(Mid(str, InStr(str, " ") + 1), ",")
strRun = CStr(frmMain.mscScript.Run(strName, strExpress(0), strExpress(1)))
End Function
需要注意是类模块要生成对象:Public objScript As New clsFunction,这个知识在一般程序开发下很少接触;
然后就是vbScript(脚本)和Visual Basic的区别,前者是后者的子集,语法上不能混乱
最常见的错误是:vbscript的变量只有Variant类型,Next 后面不跟变量名等...
源代码在我的资源那里有,
http://prsniper.download.csdn.net/user/prsniper/all/1
希望更多的人学好编程,不断提高技术,深度的探讨可以加我QQ:627666017
空间只面向新手,,,
相关文档:
内容提要摘要: The software of visual basic developed by Microsoft corporation is becoming one of the main develop tools at today。 As it's remarkable peculiarity, the Grid control has very great practical and active use。 This topic discusses how to use the grid control of VB to develop prati ......
把鼠标移到屏幕指定位置 如(111.111) 单击一下
再移到屏幕另一指定位置指定位置 如(222.222)单击一下
Private Declare Sub mouse_event Lib "user32" (ByVal dwFlags As Long, ByVal dx As Long, ByVal dy As Long, ByVal cButtons As Long, ByVal dwExtraInfo As Long)
Private Declare Function SetCursorPo ......
VB下如何编写CRC校验程序
随着计算机技术的不断发展,在现代工业中,利用微机进行数据通讯的工业控制应用得也越来越广泛。由于传输距离、现场状况等诸多可能出现的因素影响,计算机与受控设备之间的通讯数据常会发生无法预测的错误。为了防止错误所带来的影响,一般在通讯时采取数据校验的办法,而循环冗余码校 ......
简单
在Global.asa文件中加入如下的代码:
Java代码
1. <SCRIPT LANGUAGE="VBScript" RUNAT="Server">
2.
3. Sub Application_OnStart
4.
5. '当服务器开启时,设置在线用户计数器为0
6. Application("ActiveUsers") = 0
7.
......
'引用:Microfoft VBScript Regular Expressions 5.5 '一个正则提取功能
Public Function regGetStr_three(ByVal myString As String, ByVal patReg As String) As String()
Dim objRegExp As RegExp
Dim objMatch As Match
Dim colMatches As Ma ......