OLEAutoObjectEx

Public support forum for peer to peer support with related to the Visual Objects and Vulcan.NET products
Post Reply
Jores
Posts: 4
Joined: Tue Aug 14, 2018 12:11 pm

OLEAutoObjectEx

Post by Jores »

Hello,

How to use OLEAutoObjectEx in X# ?
When compiled, the result is:
error XS0246: The type or namespace name 'OLEAutoObjectEx' could not be found (are you missing a using directive or an assembly reference?)

Best regards.
Georgi Georgiev  
 
User avatar
robert
Posts: 4520
Joined: Fri Aug 21, 2015 10:57 am
Location: Netherlands

OLEAutoObjectEx

Post by robert »

Georgi,
This class is indeed not part of our runtime (yet).
Can you try it with OleAutoObject ?
What extra functionality are you using from OleAutoObjectEx?

Robert
XSharp Development Team
The Netherlands
robert@xsharp.eu
Jores
Posts: 4
Joined: Tue Aug 14, 2018 12:11 pm

OLEAutoObjectEx

Post by Jores »

Hello, Mr. Robert,

I use many functions written in .Net and called via COM.
I can transfer them to X#, but first I want to fix the other errors.
I will use the OLEAutoObject class to continue the transfer.

Thanks for the quick response and for the X# software!

Best regards.
Georgi Georgiev  
 
User avatar
Meinhard
Posts: 81
Joined: Thu Oct 01, 2015 4:51 pm

OLEAutoObjectEx

Post by Meinhard »

Hi Georgi!

The class OleAutoObjectEx was introduced to VO by me in 2.8 SP4 to make accessing COM components a little more variable. Actually you don't need that and can stick to OleAutoObject. But, if you're COM components are written in .Net, you don't need to use this class. simply refer to the implementing assembly in your X# program and use the classes in there directly! Faster and more reliable, as you omit all the untyped stuff in the OleAutoObject area.

Regards
Meinhard
Jores
Posts: 4
Joined: Tue Aug 14, 2018 12:11 pm

OLEAutoObjectEx

Post by Jores »

Hello, Mr. Meinhard,

Thanks for the reply.

COM components are written in .Net
Could you give an example of direct use of classes?

Best regards.
Georgi Georgiev
User avatar
Meinhard
Posts: 81
Joined: Thu Oct 01, 2015 4:51 pm

OLEAutoObjectEx

Post by Meinhard »

Hi Georgi,

depends, do you own the source of the .net part of the COM components? I would need to know what classes and interfaces are implemented in the .net assembly which way has been used to register them with COM.
In Principle this usually works similar to this (sample of my own a COM component to show Google maps nad cosume Google Map Api from VO) :

    [ComVisible(true)]
    [Guid("a specific guid")]
    [ClassInterface(ClassInterfaceType.None)]
    [ProgId("GMapConnector.GMapConnectorClass")]
    public class GMapConnector :IGMapConnector
    {
        public virtual string ShowMap(IGMapParameterObject parameter)
        {
          ....
        }
    }

  and 

    [ComVisible(true)]
    [Guid("yet another specific guid")]
    [InterfaceType(ComInterfaceType.InterfaceIsIDispatch)]
    public interface IGMapConnector    
    {
        [DispId(1)]
        string ShowMap(IGMapParameterObject parameter);
        .....
    }

Then, after generating the classes inside the VO IDE you can use this like :

    local connector as IGMapConnector

    connector := IGMapConnector{}    
    if connector:fInit
    ....
    endif

Where IGMapConnector is the generated class and inherited from OleAutoObject(ex).

Now, the interface is just a kind of meta information for the COM marshalling process to call the corresponding method in the implementing class (GMapConnector ) correctly. Therefor it not neccessary in the .net Environment. In X# for example (after adding the correspronding assembly to your project) you can do:

local connector := GMapConnector{} as IGMapConnector

This way you talk to the implementing class directly without all the COM overhead.

HTH & Regards
Meinhard
  

 
Jores
Posts: 4
Joined: Tue Aug 14, 2018 12:11 pm

OLEAutoObjectEx

Post by Jores »

Hello, Mr. Meinhard,

Thank you very much for the example you wrote.

Best regards.
Georgi Georgiev
Post Reply