Login | |
|
 |
Re: ATL COM object not visible to script - 5/24/2001 6:55:23 AM
|
|
 |
|
| |
hennykoe
Posts: 9
Score: 0
Joined: 5/23/2001
From:
Status: offline
|
Hi Dean, I do not have extensive experience in C & VB but I can tell that VBScript can access properties, methods and events exposed in COM Objects. An application of this is accessing ADO Active-x object which is created in C. To the best of my knowledge, in vbscript you can not declare a variable as either public or private because VBScript only have one data type (variant) Here is an example of referencing an MTS component in VBScript ' Holds the transaction context Dim objTxCtx ' Holds the MTS object Dim objMTxAs ' Holds the event log object Dim objEventLog ' Holds the error handler object Dim objErrorHandler ' Get the reference to MTS Set objMTxAs = CreateObject("MTxAS.AppServer.1") ' Get the MTS Transaction context Set objTxCtx = objMTxAs.GetObjectContext ' Create an instance of the event log class Set objEventLog = objTxCtx.CreateInstance("EventLog.clsEventLog") ' Create an instance of the error handler class Set objErrorHandler = objTxCtx.CreateInstance( _ "ErrorHandler.clsErrorHandler") ' Write an information event to the event log objEventLog.WriteEvent "VBScript", "VBScript", _ INFORMATION_TYPE, 1003, "MYPC", 5 ' Log an error message objErrorHandler.LogError "modTest.Test", "This error occured", _ PU_LNG_ERR_SHOW_MESSAGE ' ... Do all your other stuff here ' Abort the transaction objTxCtx.SetAbort Hope this helps:)
|
|
| |
|
|
|
| |
|
|
 |
|
 |
|
|