//+---------------------------------------------------------------------------
//
//  (C) Copyright 1997 Microsoft Corporation. All Rights Reserved.
//
//  Contents:   Declarations for ActiveX Scripting host applications and script engines
//
//----------------------------------------------------------------------------

cpp_quote(     "//=--------------------------------------------------------------------------=")
cpp_quote(     "// ActivScp.h")
cpp_quote(     "//=--------------------------------------------------------------------------=")
cpp_quote(     "// (C) Copyright 1997 Microsoft Corporation.  All Rights Reserved.")
cpp_quote(     "//")
cpp_quote(     "// THIS CODE AND INFORMATION IS PROVIDED \"AS IS\" WITHOUT WARRANTY OF")
cpp_quote(     "// ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO")
cpp_quote(     "// THE IMPLIED WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A")
cpp_quote(     "// PARTICULAR PURPOSE.")
cpp_quote(     "//=--------------------------------------------------------------------------=")
cpp_quote(     "//")
cpp_quote("#pragma comment(lib,\"uuid.lib\")")
cpp_quote(     "//")
cpp_quote(     "// Declarations for ActiveX Scripting host applications and script engines.")
cpp_quote(     "//")

cpp_quote(     "")
cpp_quote(     "#ifndef __ActivScp_h")
cpp_quote(     "#define __ActivScp_h")
cpp_quote(     "")


#ifndef DO_NO_IMPORTS
import "ocidl.idl";
import "oleidl.idl";
import "oaidl.idl";
#endif

cpp_quote(     "/* GUIDs")
cpp_quote(     " ********/")
cpp_quote(     "")

cpp_quote(     "#ifndef _NO_SCRIPT_GUIDS")

cpp_quote(     "// {F0B7A1A1-9847-11cf-8F20-00805F2CD064}")
cpp_quote(     "DEFINE_GUID(CATID_ActiveScript, 0xf0b7a1a1, 0x9847, 0x11cf, 0x8f, 0x20, 0x0, 0x80, 0x5f, 0x2c, 0xd0, 0x64);")
cpp_quote(     "")

cpp_quote(     "// {F0B7A1A2-9847-11cf-8F20-00805F2CD064}")
cpp_quote(     "DEFINE_GUID(CATID_ActiveScriptParse, 0xf0b7a1a2, 0x9847, 0x11cf, 0x8f, 0x20, 0x0, 0x80, 0x5f, 0x2c, 0xd0, 0x64);")
cpp_quote(     "")

cpp_quote(     "// {BB1A2AE1-A4F9-11cf-8F20-00805F2CD064}")
cpp_quote(     "DEFINE_GUID(IID_IActiveScript, 0xbb1a2ae1, 0xa4f9, 0x11cf, 0x8f, 0x20, 0x0, 0x80, 0x5f, 0x2c, 0xd0, 0x64);")
cpp_quote(     "")

cpp_quote(     "// {BB1A2AE2-A4F9-11cf-8F20-00805F2CD064}")
cpp_quote(     "DEFINE_GUID(IID_IActiveScriptParse, 0xbb1a2ae2, 0xa4f9, 0x11cf, 0x8f, 0x20, 0x0, 0x80, 0x5f, 0x2c, 0xd0, 0x64);")
cpp_quote(     "")

cpp_quote(     "// {1CFF0050-6FDD-11d0-9328-00A0C90DCAA9}")
cpp_quote(     "DEFINE_GUID(IID_IActiveScriptParseProcedureOld, 0x1cff0050, 0x6fdd, 0x11d0, 0x93, 0x28, 0x0, 0xa0, 0xc9, 0xd, 0xca, 0xa9);")
cpp_quote(     "")

cpp_quote(     "// {AA5B6A80-B834-11d0-932F-00A0C90DCAA9}")
cpp_quote(     "DEFINE_GUID(IID_IActiveScriptParseProcedure, 0xaa5b6a80, 0xb834, 0x11d0, 0x93, 0x2f, 0x0, 0xa0, 0xc9, 0xd, 0xca, 0xa9);")
cpp_quote(     "")

cpp_quote(     "// {DB01A1E3-A42B-11cf-8F20-00805F2CD064}")
cpp_quote(     "DEFINE_GUID(IID_IActiveScriptSite, 0xdb01a1e3, 0xa42b, 0x11cf, 0x8f, 0x20, 0x0, 0x80, 0x5f, 0x2c, 0xd0, 0x64);")
cpp_quote(     "")

cpp_quote(     "// {D10F6761-83E9-11cf-8F20-00805F2CD064}")
cpp_quote(     "DEFINE_GUID(IID_IActiveScriptSiteWindow, 0xd10f6761, 0x83e9, 0x11cf, 0x8f, 0x20, 0x0, 0x80, 0x5f, 0x2c, 0xd0, 0x64);")
cpp_quote(     "")

cpp_quote(     "// {539698A0-CDCA-11CF-A5EB-00AA0047A063}")
cpp_quote(     "DEFINE_GUID(IID_IActiveScriptSiteInterruptPoll, 0x539698a0, 0xcdca, 0x11cf, 0xa5, 0xeb, 0x00, 0xaa, 0x00, 0x47, 0xa0, 0x63);")
cpp_quote(     "")

cpp_quote(     "// {EAE1BA61-A4ED-11cf-8F20-00805F2CD064}")
cpp_quote(     "DEFINE_GUID(IID_IActiveScriptError, 0xeae1ba61, 0xa4ed, 0x11cf, 0x8f, 0x20, 0x0, 0x80, 0x5f, 0x2c, 0xd0, 0x64);")
cpp_quote(     "")

cpp_quote(     "// {63CDBCB0-C1B1-11d0-9336-00A0C90DCAA9}")
cpp_quote(     "DEFINE_GUID(IID_IBindEventHandler, 0x63cdbcb0, 0xc1b1, 0x11d0, 0x93, 0x36, 0x0, 0xa0, 0xc9, 0xd, 0xca, 0xa9);")
cpp_quote(     "")

cpp_quote(     "// {B8DA6310-E19B-11d0-933C-00A0C90DCAA9}")
cpp_quote(     "DEFINE_GUID(IID_IActiveScriptStats, 0xb8da6310, 0xe19b, 0x11d0, 0x93, 0x3c, 0x0, 0xa0, 0xc9, 0xd, 0xca, 0xa9);")
cpp_quote(     "")

cpp_quote(     "#endif // _NO_SCRIPT_GUIDS")
cpp_quote(     "")

cpp_quote(     "// Constants used by ActiveX Scripting:")
cpp_quote(     "//")
cpp_quote(     "")
cpp_quote(     "/* IActiveScript::AddNamedItem() input flags */")
cpp_quote(     "")
cpp_quote(     "#define SCRIPTITEM_ISVISIBLE            0x00000002")
cpp_quote(     "#define SCRIPTITEM_ISSOURCE             0x00000004")
cpp_quote(     "#define SCRIPTITEM_GLOBALMEMBERS        0x00000008")
cpp_quote(     "#define SCRIPTITEM_ISPERSISTENT         0x00000040")
cpp_quote(     "#define SCRIPTITEM_CODEONLY             0x00000200")
cpp_quote(     "#define SCRIPTITEM_NOCODE               0x00000400")
cpp_quote(     "")
cpp_quote(     "#define SCRIPTITEM_ALL_FLAGS            (SCRIPTITEM_ISSOURCE | \\")
cpp_quote(     "                                         SCRIPTITEM_ISVISIBLE | \\")
cpp_quote(     "                                         SCRIPTITEM_ISPERSISTENT | \\")
cpp_quote(     "                                         SCRIPTITEM_GLOBALMEMBERS | \\")
cpp_quote(     "                                         SCRIPTITEM_NOCODE | \\")
cpp_quote(     "                                         SCRIPTITEM_CODEONLY)")
cpp_quote(     "")
cpp_quote(     "/* IActiveScript::AddTypeLib() input flags */")
cpp_quote(     "")
cpp_quote(     "#define SCRIPTTYPELIB_ISCONTROL         0x00000010")
cpp_quote(     "#define SCRIPTTYPELIB_ISPERSISTENT      0x00000040")
cpp_quote(     "#define SCRIPTTYPELIB_ALL_FLAGS         (SCRIPTTEXT_ISCONTROL | SCRIPTTYPELIB_ISPERSISTENT)")
cpp_quote(     "")
cpp_quote(     "/* IActiveScriptParse::AddScriptlet() and IActiveScriptParse::ParseScriptText() input flags */")
cpp_quote(     "")
cpp_quote(     "#define SCRIPTTEXT_DELAYEXECUTION       0x00000001")
cpp_quote(     "#define SCRIPTTEXT_ISVISIBLE            0x00000002")
cpp_quote(     "#define SCRIPTTEXT_ISEXPRESSION         0x00000020")
cpp_quote(     "#define SCRIPTTEXT_ISPERSISTENT         0x00000040")
cpp_quote(     "#define SCRIPTTEXT_HOSTMANAGESSOURCE    0x00000080")
cpp_quote(     "#define SCRIPTTEXT_ALL_FLAGS            (SCRIPTTEXT_DELAYEXECUTION | \\")
cpp_quote(     "                                         SCRIPTTEXT_ISVISIBLE | \\")
cpp_quote(     "                                         SCRIPTTEXT_ISEXPRESSION | \\")
cpp_quote(     "                                         SCRIPTTEXT_ISPERSISTENT | \\")
cpp_quote(     "                                         SCRIPTTEXT_HOSTMANAGESSOURCE)")
cpp_quote(     "")
cpp_quote(     "/* IActiveScriptParseProcedure::ParseProcedureText() input flags */")
cpp_quote(     "")
cpp_quote(     "#define SCRIPTPROC_HOSTMANAGESSOURCE    0x00000080")
cpp_quote(     "#define SCRIPTPROC_IMPLICIT_THIS        0x00000100")
cpp_quote(     "#define SCRIPTPROC_IMPLICIT_PARENTS     0x00000200")
cpp_quote(     "#define SCRIPTPROC_ALL_FLAGS            (SCRIPTPROC_HOSTMANAGESSOURCE | \\")
cpp_quote(     "                                         SCRIPTPROC_IMPLICIT_THIS | \\")
cpp_quote(     "                                         SCRIPTPROC_IMPLICIT_PARENTS)")
cpp_quote(     "")
cpp_quote(     "/* IActiveScriptSite::GetItemInfo() input flags */")
cpp_quote(     "")
cpp_quote(     "#define SCRIPTINFO_IUNKNOWN             0x00000001")
cpp_quote(     "#define SCRIPTINFO_ITYPEINFO            0x00000002")
cpp_quote(     "#define SCRIPTINFO_ALL_FLAGS            (SCRIPTINFO_IUNKNOWN | \\")
cpp_quote(     "                                         SCRIPTINFO_ITYPEINFO)")
cpp_quote(     "")
cpp_quote(     "/* IActiveScript::Interrupt() Flags */")
cpp_quote(     "")
cpp_quote(     "#define SCRIPTINTERRUPT_DEBUG           0x00000001")
cpp_quote(     "#define SCRIPTINTERRUPT_RAISEEXCEPTION  0x00000002")
cpp_quote(     "#define SCRIPTINTERRUPT_ALL_FLAGS       (SCRIPTINTERRUPT_DEBUG | \\")
cpp_quote(     "                                         SCRIPTINTERRUPT_RAISEEXCEPTION)")
cpp_quote(     "")
cpp_quote(     "/* IActiveScriptStats::GetStat() values */")
cpp_quote(     "")
cpp_quote(     "#define SCRIPTSTAT_STATEMENT_COUNT       1")
cpp_quote(     "#define SCRIPTSTAT_INSTRUCTION_COUNT     2")
cpp_quote(     "#define SCRIPTSTAT_INTSTRUCTION_TIME     3")
cpp_quote(     "#define SCRIPTSTAT_TOTAL_TIME            4")
cpp_quote(     "")
cpp_quote(     "/* script state values */")
cpp_quote(     "")

typedef enum tagSCRIPTSTATE {
	SCRIPTSTATE_UNINITIALIZED       = 0,
	SCRIPTSTATE_INITIALIZED         = 5,
	SCRIPTSTATE_STARTED             = 1,
	SCRIPTSTATE_CONNECTED           = 2,
	SCRIPTSTATE_DISCONNECTED        = 3,
	SCRIPTSTATE_CLOSED              = 4,

} SCRIPTSTATE ;

cpp_quote(     "")
cpp_quote(     "/* script thread state values */")
cpp_quote(     "")

typedef enum tagSCRIPTTHREADSTATE {
	SCRIPTTHREADSTATE_NOTINSCRIPT   = 0,
	SCRIPTTHREADSTATE_RUNNING       = 1,
} SCRIPTTHREADSTATE ;

cpp_quote(     "")
cpp_quote(     "/* Thread IDs */")
cpp_quote(     "")

typedef DWORD SCRIPTTHREADID;

cpp_quote(     "")
cpp_quote(     "#define SCRIPTTHREADID_CURRENT  ((SCRIPTTHREADID)-1)")
cpp_quote(     "#define SCRIPTTHREADID_BASE     ((SCRIPTTHREADID)-2)")
cpp_quote(     "#define SCRIPTTHREADID_ALL      ((SCRIPTTHREADID)-3)")
cpp_quote(     "")
cpp_quote(     "/* Structures */")
cpp_quote(     "")

cpp_quote(     "/* Interfaces")
cpp_quote(     " *************/")
cpp_quote(     "")

interface IActiveScriptSite;
interface IActiveScriptSiteWindow;
interface IActiveScript;
interface IActiveScriptParse;
interface IActiveScriptParseProcedure;
interface IActiveScriptError;

cpp_quote(     "")

[
	object,
	uuid(DB01A1E3-A42B-11cf-8F20-00805F2CD064),
	pointer_default(unique)
]
interface IActiveScriptSite : IUnknown
{
	HRESULT GetLCID(
		[out] LCID *plcid);

	HRESULT GetItemInfo(
		[in]  LPCOLESTR pstrName,
		[in]  DWORD     dwReturnMask,
		[out] IUnknown  **ppiunkItem,
		[out] ITypeInfo **ppti
	);

	HRESULT GetDocVersionString(
		[out] BSTR      *pbstrVersion
	);

	HRESULT OnScriptTerminate(
		[in]  const VARIANT     *pvarResult,
		[in]  const EXCEPINFO   *pexcepinfo
	);

	HRESULT OnStateChange(
		[in]  SCRIPTSTATE       ssScriptState
	);

	HRESULT OnScriptError(
		[in]  IActiveScriptError *pscripterror
	);

	HRESULT OnEnterScript(void);

	HRESULT OnLeaveScript(void);
}

[
	object,
	uuid(EAE1BA61-A4ED-11cf-8F20-00805F2CD064),
	pointer_default(unique)
]
interface IActiveScriptError : IUnknown
{
	HRESULT GetExceptionInfo(
		[out] EXCEPINFO  *pexcepinfo
	);
	HRESULT GetSourcePosition(
		[out] DWORD     *pdwSourceContext,
		[out] ULONG     *pulLineNumber,
		[out] LONG      *plCharacterPosition    // -1 --> unknown
	);
	HRESULT GetSourceLineText(
		[out] BSTR      *pbstrSourceLine
	);
}

[
	object,
	uuid(D10F6761-83E9-11cf-8F20-00805F2CD064),
	pointer_default(unique)
]
interface IActiveScriptSiteWindow : IUnknown
{
	HRESULT GetWindow(
		[out] HWND      *phwnd
	);

	HRESULT EnableModeless(
		[in]  BOOL      fEnable
	);
}


[
	object,
	uuid(539698A0-CDCA-11CF-A5EB-00AA0047A063),
	pointer_default(unique)
]
interface IActiveScriptSiteInterruptPoll : IUnknown
{
		HRESULT QueryContinue();
}


cpp_quote(     "typedef IActiveScriptSite *PIActiveScriptSite;")

[
	object,
	uuid(BB1A2AE1-A4F9-11cf-8F20-00805F2CD064),
	pointer_default(unique)
]
interface IActiveScript : IUnknown
{
	HRESULT SetScriptSite(
		[in]  IActiveScriptSite *pass
	);

	HRESULT GetScriptSite(
		[in]                REFIID riid,
		[out, iid_is(riid)] void **ppvObject
	);

	HRESULT SetScriptState(
		[in]  SCRIPTSTATE ss
	);

	HRESULT GetScriptState(
		[out] SCRIPTSTATE *pssState
	);

	HRESULT Close(void);

	HRESULT AddNamedItem(
		[in]  LPCOLESTR pstrName,
		[in]  DWORD     dwFlags
	);

	HRESULT AddTypeLib(
		[in]  REFGUID   rguidTypeLib,
		[in]  DWORD     dwMajor,
		[in]  DWORD     dwMinor,
		[in]  DWORD     dwFlags
	);

	HRESULT GetScriptDispatch(
		[in]  LPCOLESTR pstrItemName,
		[out] IDispatch **ppdisp
	);

	HRESULT GetCurrentScriptThreadID(
		[out] SCRIPTTHREADID *pstidThread
	);

	HRESULT GetScriptThreadID(
		[in]  DWORD             dwWin32ThreadId,
		[out] SCRIPTTHREADID    *pstidThread
	);

	HRESULT GetScriptThreadState(
		[in]  SCRIPTTHREADID    stidThread,
		[out] SCRIPTTHREADSTATE *pstsState
	);

	HRESULT InterruptScriptThread(
		[in]  SCRIPTTHREADID    stidThread,
		[in]  const EXCEPINFO   *pexcepinfo,
		[in]  DWORD dwFlags
	);

	HRESULT Clone(
		[out] IActiveScript     **ppscript
	);

}

cpp_quote(     "typedef IActiveScript *PIActiveScript;")

[
	object,
	uuid(BB1A2AE2-A4F9-11cf-8F20-00805F2CD064),
	pointer_default(unique)
]
interface IActiveScriptParse : IUnknown
{
	HRESULT InitNew(void);

	HRESULT AddScriptlet(
		[in]  LPCOLESTR         pstrDefaultName,
		[in]  LPCOLESTR         pstrCode,
		[in]  LPCOLESTR         pstrItemName,
		[in]  LPCOLESTR         pstrSubItemName,
		[in]  LPCOLESTR         pstrEventName,
		[in]  LPCOLESTR         pstrDelimiter,
		[in]  DWORD             dwSourceContextCookie,
		[in]  ULONG             ulStartingLineNumber,
		[in]  DWORD             dwFlags,
		[out] BSTR              *pbstrName,
		[out] EXCEPINFO         *pexcepinfo
	);

	HRESULT ParseScriptText(
		[in]  LPCOLESTR         pstrCode,
		[in]  LPCOLESTR         pstrItemName,
		[in]  IUnknown          *punkContext,
		[in]  LPCOLESTR         pstrDelimiter,
		[in]  DWORD             dwSourceContextCookie,
		[in]  ULONG             ulStartingLineNumber,
		[in]  DWORD             dwFlags,
		[out] VARIANT           *pvarResult,
		[out] EXCEPINFO         *pexcepinfo
	);

}
cpp_quote(     "")
cpp_quote(     "typedef IActiveScriptParse *PIActiveScriptParse;")
cpp_quote(     "")

[
	object,
	uuid(1CFF0050-6FDD-11d0-9328-00A0C90DCAA9),
	pointer_default(unique)
]
interface IActiveScriptParseProcedureOld : IUnknown
{
	HRESULT ParseProcedureText(
		[in]  LPCOLESTR         pstrCode,
		[in]  LPCOLESTR         pstrFormalParams,
		[in]  LPCOLESTR         pstrItemName,
		[in]  IUnknown          *punkContext,
		[in]  LPCOLESTR         pstrDelimiter,
		[in]  DWORD             dwSourceContextCookie,
		[in]  ULONG             ulStartingLineNumber,
		[in]  DWORD             dwFlags,
		[out] IDispatch         **ppdisp
	);
}


[
	object,
	uuid(AA5B6A80-B834-11d0-932F-00A0C90DCAA9),
	pointer_default(unique)
]
interface IActiveScriptParseProcedure : IUnknown
{
	HRESULT ParseProcedureText(
		[in]  LPCOLESTR         pstrCode,
		[in]  LPCOLESTR         pstrFormalParams,
		[in]  LPCOLESTR         pstrProcedureName,
		[in]  LPCOLESTR         pstrItemName,
		[in]  IUnknown          *punkContext,
		[in]  LPCOLESTR         pstrDelimiter,
		[in]  DWORD             dwSourceContextCookie,
		[in]  ULONG             ulStartingLineNumber,
		[in]  DWORD             dwFlags,
		[out] IDispatch         **ppdisp
	);
}


[
	object,
	uuid(63CDBCB0-C1B1-11d0-9336-00A0C90DCAA9),
	pointer_default(unique)
]
interface IBindEventHandler : IUnknown
{
	HRESULT BindHandler(
		[in]  LPCOLESTR         pstrEvent,
		[in]  IDispatch         *pdisp
	);
}


[
	object,
	uuid(B8DA6310-E19B-11d0-933C-00A0C90DCAA9),
	pointer_default(unique)
]
interface IActiveScriptStats : IUnknown
{
	HRESULT GetStat(
		[in] DWORD stid,
		[out] ULONG *pluHi,
		[out] ULONG *pluLo
	);

	HRESULT GetStatEx(
		[in]  REFGUID guid,
		[out] ULONG *pluHi,
		[out] ULONG *pluLo
	);

	HRESULT ResetStats(void);
}


cpp_quote(     "")
cpp_quote(     "#endif  // __ActivScp_h")
cpp_quote(     "")

