I have one COM server that implements one method/property that returns int .
The CreateObject does create the instance of com server.
The problem is that I get error when trying to access its method/property
with the annoying behaviour that in some computer it works and in others it
doesn't

Dim app
Dim result

Set app = CreateObject("MyApp.MyApplication")
result = app.Result

When trying with VB6.0 to check with more detais. I did:
Dim app as Object ....
and I got the same error, but if I do
Dim app as MyApplication
it works.

Looks like the "casting" from generic Object type to use defined type is not
working on those computers where I get the error.

Does anyone had similar problems before, or what is the cause of it?

Thanks on advance

alex

Re: CreateObject suucceed but using members fails by Michael

Michael
Thu Feb 17 19:47:00 CST 2005

a_sakuma wrote:
> I have one COM server that implements one method/property that
> returns int . The CreateObject does create the instance of com server.
> The problem is that I get error when trying to access its
> method/property with the annoying behaviour that in some computer it
> works and in others it doesn't

Take a look at this and see if it leads to an explanation/solution...

Building COM Components That Take Full Advantage of Visual Basic and
Scripting
http://msdn.microsoft.com/library/techart/msdn_vbscriptcom.htm

There are many issues to consider when writing COM components intended to be
used from script clients. Most are in the ASP context, but ASP is just
another ActiveX script host environment, so the issues apply to WSH hosted
scripts as well...

Type Mismatch When Passing Parameters from ASP to VB
http://support.microsoft.com/default.aspx?kbid=165967

Q197957 - PRB: Passing Parameters By Reference to a VC COM Object
http://support.microsoft.com/default.aspx?kbid=197957

Q197956 - PRB: Passing Parameters By Reference to a VB COM Object
http://support.microsoft.com/default.aspx?kbid=197956

Q174576 - HOWTO: Return Arrays from Server-Side Objects in ASP
http://support.microsoft.com/default.aspx?kbid=174576

Q218454 - HOWTO: Implement Array Arguments in Visual C++ COM Objects for
Active Server Pages
http://support.microsoft.com/default.aspx?kbid=218454

Q217114 - HOWTO: Implement Array Arguments in Visual Basic COM Objects for
Active Server Pages
http://support.microsoft.com/default.aspx?kbid=217114

Q190272 - PRB: Semantic Compatibility Problem with Hardtypes in VBScript
http://support.microsoft.com/default.aspx?kbid=190272

Q269258 - INFO: JScript Passes Variables by Value
http://support.microsoft.com/default.aspx?kbid=269258

Q253282 - PRB: Changes to ByRef Parameters in Script Event Handlers Are Not
Passed to Controls
http://support.microsoft.com/default.aspx?kbid=253282
--
Michael Harris
Microsoft MVP Scripting
http://maps.google.com/maps?q=Sammamish%20WA%20US