SamScrpt.exe sample demonstrates implement Active Debugging in an ActiveX Script Engine built in straight C++

This article was previously published under Q216271
This article has been archived. It is offered "as is" and will no longer be updated.
SamScrpt.exe is a sample that demonstrates how to implement Active Debugging in an ActiveX Script Engine built in straight C++. It is designed to demonstrate some of the more advanced features of Active Debugging, such as expression evaluation and variable windows.
The following file is available for download from the Microsoft Download Center:


For additional information about how to download Microsoft Support files, click the following article number to view the article in the Microsoft Knowledge Base:
119591 How to Obtain Microsoft Support Files from Online Services
Microsoft scanned this file for viruses. Microsoft used the most current virus-detection software that was available on the date that the file was posted. The file is stored on security-enhanced servers that help to prevent any unauthorized changes to the file.

This sample demonstrates how to build an ActiveX Script Engine, including support for Active Debugging. ActiveX Scripting allows Hosts such as Internet Explorer to execute scripts without having to be concerned with the actual implementation of the language engine. Active Debugging builds on Active Scripting and enables debugger host applications, like the Microsoft Script Debugger, to provide comprehensive, language-independent testing and error correcting capabilities. Functionality such as breakpoints, expression evaluation, and data monitoring are all possible through the Active Debugging interfaces. Active Debugging also makes it possible to debug multiple scripts in different languages concurrently, making cross-language issues easier to locate and correct.

While every attempt has been made to make this sample engine accurate, it is not a commercial quality application. Microsoft does not support the use of this engine in any capacity.

SamScrpt.exe301 KB
SampleScript.ncb193 KB
DLLFunctions.cpp8 KB
DLLFunctions.h1 KB
Readme.txt3 KB
SampleScript.def1 KB
SampleScriptDocs.doc128 KB
TestPage.htm6 KB
SampleScript.dsw1 KB
SampleScript.plg5 KB
SampleScript.dsp10 KB
SampleScript.opt53 KB
rc1.rc1 KB
resource.h3 KB
rc1.aps22 KB
English.cpp1 KB
English.plg2 KB
English.dsp4 KB
DebugExpression.cpp13 KB
DebugExpression.h2 KB
DebugInstruction.cpp6 KB
DebugInstruction.h2 KB
DebugInterpreter.h4 KB
DebugScript.h3 KB
DebugStackedSymbolTable.cpp11 KB
DebugStackedSymbolTable.h2 KB
EDebugStackFrames.h2 KB
EnumSymbols.cpp9 KB
debugDepends.h4 KB
EnumSymbols.h9 KB
EDebugStackFrames.cpp9 KB
DebugParser.h1 KB
DebugParser.cpp3 KB
EDebugCodeContexts.h2 KB
DebugClassFactory.h2 KB
DebugClassFactory.cpp5 KB
SimpleHostBackup.h4 KB
SimpleHostBackup.cpp26 KB
DebugProperty.h2 KB
DebugProperty.cpp10 KB
EDebugCodeContexts.cpp9 KB
DebugScript.cpp28 KB
DebugErrorHandler.h2 KB
DebugErrorHandler.cpp10 KB
CScanner.h2 KB
CScanner.cpp19 KB
ActiveDebugTrace.h2 KB
DebugInterpreter.cpp38 KB
ExtendedDSFDescriptor.cpp13 KB
ExtendedDSFDescriptor.h2 KB
depends.h3 KB
CInstruction.h2 KB
CParserSet.h7 KB
CProductions.h2 KB
ScriptVariant.cpp20 KB
ScriptVariant.h3 KB
StackedSymbolTable.cpp6 KB
StackedSymbolTable.h1 KB
SymbolTable.h2 KB
TStack.h2 KB
CInterpreter.h2 KB
ErrorHandler.h3 KB
ErrorHandler.cpp6 KB
InterpreterTrace.h1 KB
CLexer.cpp23 KB
CLexer.h7 KB
CInstruction.cpp5 KB
SymbolTable.cpp4 KB
CParser.h6 KB
CParser.cpp35 KB
CInterpreter.cpp28 KB
TList.h7 KB
activeDepends.h3 KB
CASInterpreter.h3 KB
CEventHandler.h3 KB
NamedItem.cpp5 KB
NamedItem.h2 KB
SampleClassFactory.cpp5 KB
SampleClassFactory.h2 KB
CASErrorHandler.cpp11 KB
CASErrorHandler.h2 KB
ActiveScriptTrace.h1 KB
CEventHandler.cpp20 KB
SampleScript.h5 KB
SampleScript.cpp57 KB
CASInterpreter.cpp32 KB
ad1.lib19 KB
activdbg.h323 KB
activscp.h67 KB
ad1ex.h39 KB
dbgprop.h50 KB
HostInfo.h1 KB

Installation Instructions

  1. Add the following paths to the Include directories in the \Tools\Options\ directory. Replace ... with the path where SampleScript was installed.

    ...\SampleScript\Active Script Engine\
    ...\SampleScript\Active Debugging\

    Drag the ...\SampleScript\scripting\ path to the top of the list so it is checked first.
  2. Add the following paths to the library directories in the \Tools\Options\ directory. Replace ... with the path where SampleScript was installed.


    Drag the ...\SampleScript\scripting\ path to the top of the list so it is checked first.
  3. From the Project menu, click Settings and click the Link tab. In the Object/Library modules, make sure that ad1.lib is referenced. This file contains GUIDs necessary for Active Debugging.
  4. Build the project. You need to modify the Objsafe.h file in the Visual C++ Include directory if you get the following error messages:
    error C2065: 'INTERFACE_USES_DISPEX' : undeclared identifier
    error C2065: 'INTERFACE_USES_SECURITY_MANAGER' : undeclared identifier
    Find the definitions for the Option bits for IObjectSafety, and add definitions for INTERFACE_USES_DISPEX and INTERFACE_USES_SECURITY_MANAGER, as shown below. These bits are required by Internet Explorer.
       // Option bit definitions for IObjectSafety:   #define	INTERFACESAFE_FOR_UNTRUSTED_CALLER	0x00000001      // Caller of interface may be untrusted   #define	INTERFACESAFE_FOR_UNTRUSTED_DATA	0x00000002      // Data may be untrusted   #define	INTERFACE_USES_DISPEX	            0x00000004      // Object knows to use IDispatchEx   #define	INTERFACE_USES_SECURITY_MANAGER	    0x00000008      // Object knows to use IInternetHostSecurityManager						
  5. Register the SampleScript.dll by using Regsvr32.
  6. Copy the English.dll file to the same directory as SampleScript.dll.
For additional information about Active Debugging, click the article number below to view the article in the Microsoft Knowledge Base:
216073 SAMPLE: 4thScrpt.exe Demos Active Debugging in ATL ActiveX Script Engine

Article ID: 216271 - Last Review: 02/21/2014 00:33:32 - Revision: 4.0

Microsoft Visual C++ 5.0 Enterprise Edition, Microsoft Visual C++ 6.0 Enterprise Edition, Microsoft Visual C++ 5.0 Professional Edition, Microsoft Visual C++ 6.0 Professional Edition, Microsoft Visual C++, 32-bit Learning Edition 6.0

  • kbnosurvey kbarchive kbhowto kbinfo kbdownload kbactivexscript kbfile kbsample kbfunctions KB216271