Click here to Skip to main content
15,896,063 members
Articles / Desktop Programming / WTL

Adding Macro Scripting language support to existing ATL/WTL Application

Rate me:
Please Sign up or sign in to vote.
5.00/5 (5 votes)
30 Sep 2002CPOL6 min read 152.8K   1.3K   70  
Shows how to use Microsoft Script Hosting inside existing ATL/WTL Application
// AtlScriptHost.idl : IDL source for AtlScriptHost.exe
//

// This file will be processed by the MIDL tool to
// produce the type library (AtlScriptHost.tlb) and marshalling code.

import "oaidl.idl";
import "ocidl.idl";
[
	uuid(9F8AB6AA-A15D-4276-AF2A-B2E887CBCFBC),
	version(1.0),
	helpstring("ATLScriptHost 1.0 Type Library")
]
library ATLSCRIPTHOSTLib
{
	importlib("stdole32.tlb");
	importlib("stdole2.tlb");
	
	[
		object,
		uuid(D2636BB3-30F0-4885-80AD-C24B5519F6EF),
		dual,
		helpstring("IScriptHost Interface"),
		pointer_default(unique)
	]
	interface IScriptHost : IDispatch
	{
		[id(1), helpstring("Create Script Engine")] HRESULT CreateEngine(BSTR pstrProgID);
		[id(2), helpstring("Create COM object")] HRESULT CreateObject([in]BSTR strProgID, [out,retval]LPDISPATCH* ppObject);
		[id(3), helpstring("Add a Script Item")] HRESULT AddScriptItem([in]BSTR pstrNamedItem, [in]LPUNKNOWN lpUnknown);
		[id(4), helpstring("Add Script code")] HRESULT AddScriptCode([in]BSTR pstrScriptCode);
		[id(5), helpstring("Add Scriptlet (with Event)")] HRESULT AddScriptlet([in]BSTR pstrDefaultName, [in]BSTR pstrCode, [in]BSTR pstrItemName, [in]BSTR pstrEventName);
		[id(6), helpstring("Display MessageBox with provide text")] HRESULT Display(BSTR strText);
	};

	[
		uuid(AF4E1558-5C73-4CD8-AA7E-2128B7C286B2),
		helpstring("ScriptHost Class")
	]
	coclass ScriptHost
	{
		[default] interface IScriptHost;
	};
};

By viewing downloads associated with this article you agree to the Terms of Service and the article's licence.

If a file you wish to view isn't highlighted, and is a text file (not binary), please let us know and we'll add colourisation support for it.

License

This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)


Written By
Software Developer (Senior)
United States United States
Ernest is a multi-discipline software engineer.
Skilled at software design and development for all Windows platforms.
-
MCSD (C#, .NET)
Interests: User Interface, GDI/GDI+, Scripting, Android, iOS, Windows Mobile.
Programming Skills: C/C++, C#, Java (Android), VB and ASP.NET.

I hope you will enjoy my contributions.

Comments and Discussions