Passing references to ActiveX Exe object 
Author Message
 Passing references to ActiveX Exe object

Hi,

I'm currently working on an application which requires to pass
user-defined class object references to an ActiveX exe object. I've
tried using property and procedure to pass the references but it will
result in runtime error. The reported error is as followed.

A property or method call cannot include a reference to a private
object, either as an argument or as a return value.

And here's an example of my code

My module file

public myobj as UserDefinedClass
public axobj as ActiveXClass

Public Sub Init()
:
:
set myobj = new UserDefinedClass
set axobj = new ActiveXClass
set axobj.ObjReference=myobj
:
:
End Sub

ActiveXClass
private axobj as Object
:
:
Public Property Set ObjReference(obj as Object)
    set axobj = obj
End Property
:
:

Does anyone know how to the proper way of passing references to ActiveX
object?

Thanks and Regards,
KK



Mon, 05 Jan 2004 10:18:11 GMT  
 Passing references to ActiveX Exe object
Hi,

A class in a standard EXE is private, and a reference to a private class
object cannot be passed to your ActiveX EXE.

If you move your class to an ActiveX DLL referenced by your standard EXE,
it can become public (e.g. the default MultiUse class of an ActiveX DLL is
public) and you will be able to pass a reference to an object of this class
to your ActiveX EXE.

You might want to look up in MSDN:  "Data Types Allowed in Properties and
Methods"

Regards,

John................

Quote:

> Hi,

> I'm currently working on an application which requires to pass
> user-defined class object references to an ActiveX exe object. I've
> tried using property and procedure to pass the references but it will
> result in runtime error. The reported error is as followed.

> A property or method call cannot include a reference to a private
> object, either as an argument or as a return value.

> And here's an example of my code

> My module file

> public myobj as UserDefinedClass
> public axobj as ActiveXClass

> Public Sub Init()
> :
> :
> set myobj = new UserDefinedClass
> set axobj = new ActiveXClass
> set axobj.ObjReference=myobj
> :
> :
> End Sub

> ActiveXClass
> private axobj as Object
> :
> :
> Public Property Set ObjReference(obj as Object)
>     set axobj = obj
> End Property
> :
> :

> Does anyone know how to the proper way of passing references to ActiveX
> object?

> Thanks and Regards,
> KK



Mon, 05 Jan 2004 11:11:56 GMT  
 Passing references to ActiveX Exe object
To pass UDT's around like that you will need it declared in a dll.
Create an ActiveX exe that declares this UDT and reference it in your
projects.

On Thu, 19 Jul 2001 10:18:11 +0800, Chew Kok Keng

Quote:

>Hi,

>I'm currently working on an application which requires to pass
>user-defined class object references to an ActiveX exe object. I've
>tried using property and procedure to pass the references but it will
>result in runtime error. The reported error is as followed.

>A property or method call cannot include a reference to a private
>object, either as an argument or as a return value.

>And here's an example of my code

>My module file

>public myobj as UserDefinedClass
>public axobj as ActiveXClass

>Public Sub Init()
>:
>:
>set myobj = new UserDefinedClass
>set axobj = new ActiveXClass
>set axobj.ObjReference=myobj
>:
>:
>End Sub

>ActiveXClass
>private axobj as Object
>:
>:
>Public Property Set ObjReference(obj as Object)
>    set axobj = obj
>End Property
>:
>:

>Does anyone know how to the proper way of passing references to ActiveX
>object?

>Thanks and Regards,
>KK



Mon, 05 Jan 2004 22:15:08 GMT  
 Passing references to ActiveX Exe object

Set the thing in an Object or a Variant and shove it down to the AX
Exe - if the methods/properties are there it will work if not - well
you've miss-typed.

There is little point in having anything other than a late bound AX
Exe - if you include the thing in your references you might as well
include it in your main App's code. The whole point of them is
'abstraction'.

Dim MyThing As Object
Set  MyThing = CreateObject( "TheExeInternalName.TheClass" )

MyThing.DoSomething( Param1, Param2 )

Also try passing 'Me' down to the AX Exe - that way you can get
Callbacks.

On Thu, 19 Jul 2001 10:18:11 +0800, Chew Kok Keng

Quote:

>Hi,

>I'm currently working on an application which requires to pass
>user-defined class object references to an ActiveX exe object. I've
>tried using property and procedure to pass the references but it will
>result in runtime error. The reported error is as followed.

>A property or method call cannot include a reference to a private
>object, either as an argument or as a return value.

>And here's an example of my code

>My module file

>public myobj as UserDefinedClass
>public axobj as ActiveXClass

>Public Sub Init()
>:
>:
>set myobj = new UserDefinedClass
>set axobj = new ActiveXClass
>set axobj.ObjReference=myobj
>:
>:
>End Sub

>ActiveXClass
>private axobj as Object
>:
>:
>Public Property Set ObjReference(obj as Object)
>    set axobj = obj
>End Property
>:
>:

>Does anyone know how to the proper way of passing references to ActiveX
>object?

>Thanks and Regards,
>KK



Tue, 06 Jan 2004 04:53:34 GMT  
 Passing references to ActiveX Exe object
This is all true, but in some cases you'll want the data structure or
object in other apps.  I have a series of utilities that all use
certain UDTs and it is handy to have a 'type library' to reference
instead of having this code in each utility.  It also gives me a
central location for changes to this structure.

As far as I know  using ActiveX exes is the only way to achieve a type
library kind of thing in VB.

Take care,
Troy



Quote:

>Set the thing in an Object or a Variant and shove it down to the AX
>Exe - if the methods/properties are there it will work if not - well
>you've miss-typed.

>There is little point in having anything other than a late bound AX
>Exe - if you include the thing in your references you might as well
>include it in your main App's code. The whole point of them is
>'abstraction'.

>Dim MyThing As Object
>Set  MyThing = CreateObject( "TheExeInternalName.TheClass" )

>MyThing.DoSomething( Param1, Param2 )

>Also try passing 'Me' down to the AX Exe - that way you can get
>Callbacks.

>On Thu, 19 Jul 2001 10:18:11 +0800, Chew Kok Keng

>>Hi,

>>I'm currently working on an application which requires to pass
>>user-defined class object references to an ActiveX exe object. I've
>>tried using property and procedure to pass the references but it will
>>result in runtime error. The reported error is as followed.

>>A property or method call cannot include a reference to a private
>>object, either as an argument or as a return value.

>>And here's an example of my code

>>My module file

>>public myobj as UserDefinedClass
>>public axobj as ActiveXClass

>>Public Sub Init()
>>:
>>:
>>set myobj = new UserDefinedClass
>>set axobj = new ActiveXClass
>>set axobj.ObjReference=myobj
>>:
>>:
>>End Sub

>>ActiveXClass
>>private axobj as Object
>>:
>>:
>>Public Property Set ObjReference(obj as Object)
>>    set axobj = obj
>>End Property
>>:
>>:

>>Does anyone know how to the proper way of passing references to ActiveX
>>object?

>>Thanks and Regards,
>>KK



Tue, 06 Jan 2004 12:13:19 GMT  
 Passing references to ActiveX Exe object

Quote:
> object in other apps.  I have a series of utilities that all use
> certain UDTs and it is handy to have a 'type library' to reference
> instead of having this code in each utility.  It also gives me a
> central location for changes to this structure.

> As far as I know  using ActiveX exes is the only way to achieve a type
> library kind of thing in VB.

If these are just utility objects then you deffinately do NOT want them in an
AcitveX Exe.  You want them in a Dll.  It will be in-process so it will run
tremendously faster.  And there is no advantage to using an ActiveX Exe if you
are not simulating thread-like behavior (off-loading work to stop your app from
blocking).

Tom



Tue, 06 Jan 2004 21:38:55 GMT  
 Passing references to ActiveX Exe object
On Fri, 20 Jul 2001 00:13:19 -0400, Mr Todd Hampton

Quote:

>This is all true, but in some cases you'll want the data structure or
>object in other apps.  I have a series of utilities that all use
>certain UDTs and it is handy to have a 'type library' to reference
>instead of having this code in each utility.  It also gives me a
>central location for changes to this structure.

>As far as I know  using ActiveX exes is the only way to achieve a type
>library kind of thing in VB.

>Take care,
>Troy

Yes - that makes a lot of sense.
I normally try to use AX Exes like 'real' DLLs - latebound and driven
from a pure string ie:

   Set o = CreateObject( "MyAxExe.ExposedClass" )

and was looking at it from that perspective.

This could be a case for using Classes instead of (or holding) UDTs

Quote:



>>Set the thing in an Object or a Variant and shove it down to the AX
>>Exe - if the methods/properties are there it will work if not - well
>>you've miss-typed.

>>There is little point in having anything other than a late bound AX
>>Exe - if you include the thing in your references you might as well
>>include it in your main App's code. The whole point of them is
>>'abstraction'.

>>Dim MyThing As Object
>>Set  MyThing = CreateObject( "TheExeInternalName.TheClass" )

>>MyThing.DoSomething( Param1, Param2 )

>>Also try passing 'Me' down to the AX Exe - that way you can get
>>Callbacks.

>>On Thu, 19 Jul 2001 10:18:11 +0800, Chew Kok Keng

>>>Hi,

>>>I'm currently working on an application which requires to pass
>>>user-defined class object references to an ActiveX exe object. I've
>>>tried using property and procedure to pass the references but it will
>>>result in runtime error. The reported error is as followed.

>>>A property or method call cannot include a reference to a private
>>>object, either as an argument or as a return value.

>>>And here's an example of my code

>>>My module file

>>>public myobj as UserDefinedClass
>>>public axobj as ActiveXClass

>>>Public Sub Init()
>>>:
>>>:
>>>set myobj = new UserDefinedClass
>>>set axobj = new ActiveXClass
>>>set axobj.ObjReference=myobj
>>>:
>>>:
>>>End Sub

>>>ActiveXClass
>>>private axobj as Object
>>>:
>>>:
>>>Public Property Set ObjReference(obj as Object)
>>>    set axobj = obj
>>>End Property
>>>:
>>>:

>>>Does anyone know how to the proper way of passing references to ActiveX
>>>object?

>>>Thanks and Regards,
>>>KK



Wed, 07 Jan 2004 02:31:46 GMT  
 Passing references to ActiveX Exe object
Guys,

Thanks for all the help.

KK

Quote:

> > object in other apps.  I have a series of utilities that all use
> > certain UDTs and it is handy to have a 'type library' to reference
> > instead of having this code in each utility.  It also gives me a
> > central location for changes to this structure.

> > As far as I know  using ActiveX exes is the only way to achieve a type
> > library kind of thing in VB.

> If these are just utility objects then you deffinately do NOT want them in an
> AcitveX Exe.  You want them in a Dll.  It will be in-process so it will run
> tremendously faster.  And there is no advantage to using an ActiveX Exe if you
> are not simulating thread-like behavior (off-loading work to stop your app from
> blocking).

> Tom



Fri, 09 Jan 2004 09:28:02 GMT  
 Passing references to ActiveX Exe object
Quote:

> There is little point in having anything other than a late bound AX
> Exe - if you include the thing in your references you might as well
> include it in your main App's code. The whole point of them is
> 'abstraction'.

<<<

IMO avoid late binding as much as possible.  The above likely calls for an
'interface dll' and some sort of factory design pattern.

--A



Sun, 11 Jan 2004 05:49:22 GMT  
 Passing references to ActiveX Exe object


Quote:

>> There is little point in having anything other than a late bound AX
>> Exe - if you include the thing in your references you might as well
>> include it in your main App's code. The whole point of them is
>> 'abstraction'.
><<<

>IMO avoid late binding as much as possible.  The above likely calls for an
>'interface dll' and some sort of factory design pattern.

Well, yes and no - if you are going to have complicated parameters
then - yes some sort of interface module/class is a good idea.
If however you stick to really simple parameters than there is little
problem.
Quote:
>--A



Sun, 11 Jan 2004 17:25:11 GMT  
 
 [ 10 post ] 

 Relevant Pages 

1. Passing object Reference with ActiveX EXE

2. Passing object Reference with ActiveX EXE

3. Passing an object reference by reference where the object has a default property

4. Passing values by reference from java / vb script to ActiveX object

5. Passing values by reference from java / vb script to ActiveX object

6. Passing data between objects of a multithreaded ActiveX EXE

7. Removing ActiveX exe references from project->references

8. ActiveX component can't create object or return reference to this object (Error 429)

9. Activex component can't create object or return reference to this object (Error

10. Can't reference ActiveX EXE

11. ActiveX exe reference not found

12. Q. EXE and ActiveX DLL both reference DAO library

 

 
Powered by phpBB® Forum Software