When using VC 6.0 to develope script supported programs, I prefer ScriptControl (msscript.ocx). It supports JScript and VBScript. This is a very good feature. If you decided to use it in your program, the following hints will help you in accelerating your script procedure call.
- 1. use Run method instead of Eval in most cases.
- 2. create the parameter structure in advance if it's possible. I mean the situation whenfunctions (or APIs you designed) are predefined in your program.
- 3. use SafeArrayAccessData to write parameter values to SAFEARRAY. Don't forget to use SafeArrayUnaccessData when finished writing.
Originally writed by Span Zhang.
本文介绍了使用VC6.0开发支持脚本的程序时如何利用ScriptControl组件提高脚本过程调用的速度。提供了三条建议:一是尽量使用Run方法代替Eval;二是在可能的情况下预先创建参数结构;三是使用SafeArrayAccessData写入参数值到SAFEARRAY,并在完成后使用SafeArrayUnaccessData。

被折叠的 条评论
为什么被折叠?



