fbpx
Welcome, Guest
Username: Password: Remember me
Visual Objects

Please use this forum to post questions about Visual Objects and Vulcan.NET
  • Page:
  • 1

TOPIC:

OLEAutoObjectEx 14 Jan 2021 13:08 #17131

  • Jores's Avatar

  • Jores

  • Topic Author


  • Posts: 4
  • 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  
     

    Please Log in or Create an account to join the conversation.

    OLEAutoObjectEx 14 Jan 2021 15:33 #17142

  • robert's Avatar

  • robert


  • Posts: 2075
  • 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

    Please Log in or Create an account to join the conversation.

    OLEAutoObjectEx 15 Jan 2021 10:13 #17163

  • Jores's Avatar

  • Jores

  • Topic Author


  • Posts: 4
  • 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  
     

    Please Log in or Create an account to join the conversation.

    OLEAutoObjectEx 15 Jan 2021 10:51 #17165

  • Meinhard's Avatar

  • Meinhard


  • Posts: 52
  • 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

    Please Log in or Create an account to join the conversation.

    OLEAutoObjectEx 19 Jan 2021 13:35 #17226

  • Jores's Avatar

  • Jores

  • Topic Author


  • Posts: 4
  • 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

    Please Log in or Create an account to join the conversation.

    OLEAutoObjectEx 19 Jan 2021 15:50 #17234

  • Meinhard's Avatar

  • Meinhard


  • Posts: 52
  • 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
      

     

    Please Log in or Create an account to join the conversation.

    OLEAutoObjectEx 25 Jan 2021 11:41 #17286

  • Jores's Avatar

  • Jores

  • Topic Author


  • Posts: 4
  • Hello, Mr. Meinhard,

    Thank you very much for the example you wrote.

    Best regards.
    Georgi Georgiev

    Please Log in or Create an account to join the conversation.

    • Page:
    • 1