Use the script engine in. net

Source: Internet
Author: User

In the ApplicationProgramUsing the script engine can greatly enhance the flexibility and scalability of the program, similar to the macro functions of MS Office and vs. net. Microsoft. VSA. dll defines the Script Engine framework in the Microsoft. NET Framework, while Microsoft. visualbase. VSA. dll defines the script engine that implements VBA. You can use these two DLL to define your own Script Engine Based on VBA. net,

Microsoft. VSA. dll defines some framework interfaces. The important interfaces include
Ivsaengine is a script engine interface, which is used by all script engines.
Communication Interface of the ivsasite script engine. The script engine accepts this interface to publish some information.
Ivsaitem is a script engine resource project.
Ivsacodeitem is a scriptCodeModule
Ivsarefrenceitem is an external reference object used by the script engine.
Ivsaglobalitem is the global object module used by the script engine.

Generally, a script engine is instantiated to pass the ivsasite object to the script engine object. Then, reference, code text, and global objects are added using the createitem method of the engine items. call the compile method to compile the script engine and run it to start the engine.

After the script engine is started, an assembly is dynamically generated and loaded in the current application domain based on the script code, and the ivsaengine. assembly can be used to access the dynamically generated assembly.

Microsoft. visualbase. VSA. dll implements these interfaces and implements a script engine based on VBA. Net syntax.
The main object is vsaengine.

This program provides a C # written demo program, using Microsoft. net Framework 1.1. This demo program provides a general module using the script engine. You can use this module to conveniently use the VBA script engine to expand your applications.

Demo: http://files.cnblogs.com/xdesigner/VBAScriptDemo.rar

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.