Photo Gallery Member List Search Calendars FAQ Ticket List Log Out


ATL COM object not visible to script

 
Logged in as: Guest
arrSession:exec spGetSession 2,2,47
 Active Users: There are 0 members and 0 guests.
 Users viewing this topic: none
 

 

 
  
  Printable Version
All Forums >> [Scripting] >> WSH & Client Side VBScript >> ATL COM object not visible to script
  Do you like VisualBasicScript.com? Link to us and help spread the word about our forum. Thanks!
Page: [1]
Login
Message << Older Topic   Newer Topic >>
 ATL COM object not visible to script - 5/24/2001 4:26:41 AM   
  dwheatley

 

Posts: 7
Score: 0
Joined: 5/23/2001
From: Algeria
Status: offline
I have an ActiveX object (written with C++ and ATL) that has multiple CoClass's (COM objects) contained within it. In Tech speak, I have a single type library (exposed by ActiveX) that itself exposes muliple CoClass objects which are themselves COM objects.

Using VB I can access these objects easily by making a reference to the ActiveX control. VBScript doesn't seem to support this, does anyone know of a way to get at these COM objects?

My COM objects are visible in the registry, have their own type libraries and should be accessable by script... I just don't know how. Help!

Also, does anyone know if script supports events that contain references to other COM objects? For example,

Here is an example handler in VB:

Private Sub TECCardReader1_ReadOK(ByVal Data As CARDREADERLibCtl.IIDCReadDataList, ByVal timeStamp As Date)

IIDCReadDataList is an object exposed via a CoClass definition in an ATL idl file. Is this even possible in script?

Any help would be greatly appreciated. Help me forum, you're my only hope.
 
 
Post #: 1
 
 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:)

(in reply to dwheatley)
 
 
Post #: 2
 
 
 
  

If you found our site useful please link to us <a href="http://www.visualbasicscript.com">VisualBasicScript.com</a>.
All Forums >> [Scripting] >> WSH & Client Side VBScript >> ATL COM object not visible to script Page: [1]
Jump to:





New Messages No New Messages
Hot Topic w/ New Messages Hot Topic w/o New Messages
Locked w/ New Messages Locked w/o New Messages
 Post New Thread
 Reply to Message
 Post New Poll
 Submit Vote
 Delete My Own Post
 Delete My Own Thread
 Rate Posts