Recent

Author Topic: COM Control Creation And FPC  (Read 5600 times)

guest60499

  • Guest
COM Control Creation And FPC
« on: July 23, 2018, 04:11:13 am »
What kind of support is there in the compiler for COM controls? What about bindings to GObject? Can either be written in a way that avoids most of the boilerplate?

Phil

  • Hero Member
  • *****
  • Posts: 2737
Re: COM Control Creation And FPC
« Reply #1 on: July 23, 2018, 04:21:10 am »
What kind of support is there in the compiler for COM controls? What about bindings to GObject? Can either be written in a way that avoids most of the boilerplate?

Do you mean COM servers with late binding?

http://wiki.lazarus.freepascal.org/Office_Automation

Or ActiveX controls?

Install LazActiveX package.

Don't know what GObject is.

Note COM is Windows only, although operating an Office or other app externally from your own app can be done via COM on Windows and Scripting Bridge on Mac:

https://macpgmr.github.io

guest60499

  • Guest
Re: COM Control Creation And FPC
« Reply #2 on: July 23, 2018, 05:44:17 am »
I don't think so. I do mean COM servers, however anything that would be instantiated with CoCreateObject. It is my understanding in MSVC++ COM objects can be created as if they were language objects. I am attempting to imitate that.

GObject is similar to COM, but was made for GTK and is done entirely in C, sometimes with a GObject description language to C compiler.

Semi-relatedly, has anyone used the RTTI from other languages?

marcov

  • Administrator
  • Hero Member
  • *
  • Posts: 11383
  • FPC developer.
Re: COM Control Creation And FPC
« Reply #3 on: July 23, 2018, 10:48:23 am »
What kind of support is there in the compiler for COM controls?

  • Language level COM interface support.
  • Language level COM IDispatch support (disp interfaces).
  • Language COM variant support
  • Support for SEH exception handling for VS and COM compatibility, unfortunately this is not enabled for 32-bit. This will hopefully change with the next version.
  • Some libraries that implement common (Delphi?) COM baseclasses. like TAutoObject. WIP.

In general studying Delphi COM sources is a good thing to do.

IDispatch is an object where you don't have to declare what you call. Under the hood, the compiler calls a method (declared in the IDispatch interface) with the method name and parameters.

This can be used for foreign language interfaces, and was originally meant for highlevel MS Office interfacing.  Sometimes also called (a form of ) late binding

(Lower level/early binding involves just predeclaring all interfaces. This is more laborous but faster though, and the headers are typically generated from typelibs, not manually written)

Quote
What about bindings to GObject?

Afaik GObject has no relation with COM other that they are both faintly language independent. It is used here and there as part of gtk afaik, so there are some levels, but I'm not aware of other use or wrappers.

No language support, but the COM support is general enough in some cases that you can reuse it for GObject if it is capable enough.

Quote
Can either be written in a way that avoids most of the boilerplate?

Afaik Delphi COM was always easier and less verbose that VC++.

Quote
Semi-relatedly, has anyone used the RTTI from other languages?

Delphi can't even read FPC's RTTI and vice versa. So no.  Unless for IDispatch use.
« Last Edit: July 23, 2018, 10:53:08 am by marcov »

Thaddy

  • Hero Member
  • *****
  • Posts: 14204
  • Probably until I exterminate Putin.
Re: COM Control Creation And FPC
« Reply #4 on: July 23, 2018, 11:23:41 am »
  • Support for SEH exception handling for VS and COM compatibility, unfortunately this is not enabled for 32-bit. This will hopefully change with the next version.
Although you can recompile FPC 3.0.4+  WIN32 with -dTEST_WIN32_SEH. This is quite stable but needs the extra effort of a re-compile.

Note the biggest issue is the type library imports: the FPC tool generates a *._tlb.pas file that is considerably different from a Delphi generated one, because it prefers pointer types over var types for parameters. For FPC you can't always - if ever - use the Delphi *_tlb.pas.
« Last Edit: July 23, 2018, 11:41:21 am by Thaddy »
Specialize a type, not a var.

PascalDragon

  • Hero Member
  • *****
  • Posts: 5446
  • Compiler Developer
Re: COM Control Creation And FPC
« Reply #5 on: July 23, 2018, 02:01:40 pm »
  • Support for SEH exception handling for VS and COM compatibility, unfortunately this is not enabled for 32-bit. This will hopefully change with the next version.

COM does not use exceptions. Instead it relies on the HRESULT return values for which Delphi added the safecall calling convention that FPC also supports (at least on i386, x86_64 and ARM).

marcov

  • Administrator
  • Hero Member
  • *
  • Posts: 11383
  • FPC developer.
Re: COM Control Creation And FPC
« Reply #6 on: July 23, 2018, 02:20:59 pm »
  • Support for SEH exception handling for VS and COM compatibility, unfortunately this is not enabled for 32-bit. This will hopefully change with the next version.

COM does not use exceptions. Instead it relies on the HRESULT return values for which Delphi added the safecall calling convention that FPC also supports (at least on i386, x86_64 and ARM).

Yes, my bad.  If I think where this confusion comes from, the relation is that many large codebases that implement COM servers use exceptions internally that FPC currently traps before they are handled internally. (?)

guest60499

  • Guest
Re: COM Control Creation And FPC
« Reply #7 on: July 26, 2018, 04:22:10 pm »
Thanks everyone for the good information. Since the release of Delphi CE I was able to get some things working (in Delphi, and for the first time - Visual Studio has broken COM support). It looks like the generated unit will work with minimal changes. Most of what is holding me up is the uses clause:

Code: Pascal  [Select][+][-]
  1. uses
  2.   Winapi.Windows, Winapi.ActiveX,
  3.   System.Classes, System.Variants, System.Win.StdVCL,
  4.   Vcl.Graphics, Vcl.OleCtrls, Vcl.OleServer;

Can anyone help me figure out the replacements? The best I could figure out is:

Code: Pascal  [Select][+][-]
  1. uses
  2.   Windows, Classes, ActiveX, Variants, SysUtils;  

The above agrees with this post but it looks like there are many types left unimplemented, e.g. TOleControl. From reading it seems like these are not implemented and may never be? The units Ole2 and OleServer don't seem to define these types, nor does ComObj.

Here is a very small excerpt of the generated type library:

Code: Pascal  [Select][+][-]
  1.   TMsTscAxNotSafeForScripting = class(TOleControl)
  2.   private
  3.     FOnConnecting: TNotifyEvent;
  4.     FOnConnected: TNotifyEvent;
  5.     FOnLoginComplete: TNotifyEvent;
  6.     FOnDisconnected: TMsTscAxNotSafeForScriptingOnDisconnected;
  7.     FOnEnterFullScreenMode: TNotifyEvent;
  8.     FOnLeaveFullScreenMode: TNotifyEvent;
  9.     FOnChannelReceivedData: TMsTscAxNotSafeForScriptingOnChannelReceivedData;
  10.     FOnRequestGoFullScreen: TNotifyEvent;
  11.     FOnRequestLeaveFullScreen: TNotifyEvent;
  12.     FOnFatalError: TMsTscAxNotSafeForScriptingOnFatalError;
  13.     FOnWarning: TMsTscAxNotSafeForScriptingOnWarning;
  14.     FOnRemoteDesktopSizeChange: TMsTscAxNotSafeForScriptingOnRemoteDesktopSizeChange;
  15.     FOnIdleTimeoutNotification: TNotifyEvent;
  16.     FOnRequestContainerMinimize: TNotifyEvent;
  17.     FOnConfirmClose: TNotifyEvent;
  18.     FOnReceivedTSPublicKey: TMsTscAxNotSafeForScriptingOnReceivedTSPublicKey;
  19.     FOnAutoReconnecting: TMsTscAxNotSafeForScriptingOnAutoReconnecting;
  20.     FOnAuthenticationWarningDisplayed: TNotifyEvent;
  21.     FOnAuthenticationWarningDismissed: TNotifyEvent;
  22.     FOnRemoteProgramResult: TMsTscAxNotSafeForScriptingOnRemoteProgramResult;
  23.     FOnRemoteProgramDisplayed: TMsTscAxNotSafeForScriptingOnRemoteProgramDisplayed;
  24.     FOnRemoteWindowDisplayed: TMsTscAxNotSafeForScriptingOnRemoteWindowDisplayed;
  25.     FOnLogonError: TMsTscAxNotSafeForScriptingOnLogonError;
  26.     FOnFocusReleased: TMsTscAxNotSafeForScriptingOnFocusReleased;
  27.     FOnUserNameAcquired: TMsTscAxNotSafeForScriptingOnUserNameAcquired;
  28.     FOnMouseInputModeChanged: TMsTscAxNotSafeForScriptingOnMouseInputModeChanged;
  29.     FOnServiceMessageReceived: TMsTscAxNotSafeForScriptingOnServiceMessageReceived;
  30.     FOnConnectionBarPullDown: TNotifyEvent;
  31.     FOnNetworkStatusChanged: TMsTscAxNotSafeForScriptingOnNetworkStatusChanged;
  32.     FOnDevicesButtonPressed: TNotifyEvent;
  33.     FOnAutoReconnected: TNotifyEvent;
  34.     FOnAutoReconnecting2: TMsTscAxNotSafeForScriptingOnAutoReconnecting2;
  35.     FIntf: IMsTscAx;
  36.     function  GetControlInterface: IMsTscAx;
  37.   protected
  38.     procedure CreateControl;
  39.     procedure InitControlData; override;
  40.     function Get_SecuredSettings: IMsTscSecuredSettings;
  41.     function Get_AdvancedSettings: IMsTscAdvancedSettings;
  42.     function Get_Debugger: IMsTscDebug;
  43.   public
  44.     procedure Connect;
  45.     procedure Disconnect;
  46.     procedure CreateVirtualChannels(const newVal: WideString);
  47.     procedure SendOnVirtualChannel(const chanName: WideString; const ChanData: WideString);
  48.     property  ControlInterface: IMsTscAx read GetControlInterface;
  49.     property  DefaultInterface: IMsTscAx read GetControlInterface;
  50.     property Connected: Smallint index 6 read GetSmallintProp;
  51.     property HorizontalScrollBarVisible: Integer index 17 read GetIntegerProp;
  52.     property VerticalScrollBarVisible: Integer index 18 read GetIntegerProp;
  53.     property FullScreenTitle: WideString index 19 write SetWideStringProp;
  54.     property CipherStrength: Integer index 20 read GetIntegerProp;
  55.     property Version: WideString index 21 read GetWideStringProp;
  56.     property SecuredSettingsEnabled: Integer index 22 read GetIntegerProp;
  57.     property SecuredSettings: IMsTscSecuredSettings read Get_SecuredSettings;
  58.     property AdvancedSettings: IMsTscAdvancedSettings read Get_AdvancedSettings;
  59.     property Debugger: IMsTscDebug read Get_Debugger;
  60.   published
  61.     property Anchors;
  62.     property  TabStop;
  63.     property  Align;
  64.     property  DragCursor;
  65.     property  DragMode;
  66.     property  ParentShowHint;
  67.     property  PopupMenu;
  68.     property  ShowHint;
  69.     property  TabOrder;
  70.     property  Visible;
  71.     property  OnDragDrop;
  72.     property  OnDragOver;
  73.     property  OnEndDrag;
  74.     property  OnEnter;
  75.     property  OnExit;
  76.     property  OnStartDrag;
  77.     property Server: WideString index 1 read GetWideStringProp write SetWideStringProp stored False;
  78.     property Domain: WideString index 2 read GetWideStringProp write SetWideStringProp stored False;
  79.     property UserName: WideString index 3 read GetWideStringProp write SetWideStringProp stored False;
  80.     property DisconnectedText: WideString index 4 read GetWideStringProp write SetWideStringProp stored False;
  81.     property ConnectingText: WideString index 5 read GetWideStringProp write SetWideStringProp stored False;
  82.     property DesktopWidth: Integer index 12 read GetIntegerProp write SetIntegerProp stored False;
  83.     property DesktopHeight: Integer index 13 read GetIntegerProp write SetIntegerProp stored False;
  84.     property StartConnected: Integer index 16 read GetIntegerProp write SetIntegerProp stored False;
  85.     property OnConnecting: TNotifyEvent read FOnConnecting write FOnConnecting;
  86.     property OnConnected: TNotifyEvent read FOnConnected write FOnConnected;
  87.     property OnLoginComplete: TNotifyEvent read FOnLoginComplete write FOnLoginComplete;
  88.     property OnDisconnected: TMsTscAxNotSafeForScriptingOnDisconnected read FOnDisconnected write FOnDisconnected;
  89.     property OnEnterFullScreenMode: TNotifyEvent read FOnEnterFullScreenMode write FOnEnterFullScreenMode;
  90.     property OnLeaveFullScreenMode: TNotifyEvent read FOnLeaveFullScreenMode write FOnLeaveFullScreenMode;
  91.     property OnChannelReceivedData: TMsTscAxNotSafeForScriptingOnChannelReceivedData read FOnChannelReceivedData write FOnChannelReceivedData;
  92.     property OnRequestGoFullScreen: TNotifyEvent read FOnRequestGoFullScreen write FOnRequestGoFullScreen;
  93.     property OnRequestLeaveFullScreen: TNotifyEvent read FOnRequestLeaveFullScreen write FOnRequestLeaveFullScreen;
  94.     property OnFatalError: TMsTscAxNotSafeForScriptingOnFatalError read FOnFatalError write FOnFatalError;
  95.     property OnWarning: TMsTscAxNotSafeForScriptingOnWarning read FOnWarning write FOnWarning;
  96.     property OnRemoteDesktopSizeChange: TMsTscAxNotSafeForScriptingOnRemoteDesktopSizeChange read FOnRemoteDesktopSizeChange write FOnRemoteDesktopSizeChange;
  97.     property OnIdleTimeoutNotification: TNotifyEvent read FOnIdleTimeoutNotification write FOnIdleTimeoutNotification;
  98.     property OnRequestContainerMinimize: TNotifyEvent read FOnRequestContainerMinimize write FOnRequestContainerMinimize;
  99.     property OnConfirmClose: TNotifyEvent read FOnConfirmClose write FOnConfirmClose;
  100.     property OnReceivedTSPublicKey: TMsTscAxNotSafeForScriptingOnReceivedTSPublicKey read FOnReceivedTSPublicKey write FOnReceivedTSPublicKey;
  101.     property OnAutoReconnecting: TMsTscAxNotSafeForScriptingOnAutoReconnecting read FOnAutoReconnecting write FOnAutoReconnecting;
  102.     property OnAuthenticationWarningDisplayed: TNotifyEvent read FOnAuthenticationWarningDisplayed write FOnAuthenticationWarningDisplayed;
  103.     property OnAuthenticationWarningDismissed: TNotifyEvent read FOnAuthenticationWarningDismissed write FOnAuthenticationWarningDismissed;
  104.     property OnRemoteProgramResult: TMsTscAxNotSafeForScriptingOnRemoteProgramResult read FOnRemoteProgramResult write FOnRemoteProgramResult;
  105.     property OnRemoteProgramDisplayed: TMsTscAxNotSafeForScriptingOnRemoteProgramDisplayed read FOnRemoteProgramDisplayed write FOnRemoteProgramDisplayed;
  106.     property OnRemoteWindowDisplayed: TMsTscAxNotSafeForScriptingOnRemoteWindowDisplayed read FOnRemoteWindowDisplayed write FOnRemoteWindowDisplayed;
  107.     property OnLogonError: TMsTscAxNotSafeForScriptingOnLogonError read FOnLogonError write FOnLogonError;
  108.     property OnFocusReleased: TMsTscAxNotSafeForScriptingOnFocusReleased read FOnFocusReleased write FOnFocusReleased;
  109.     property OnUserNameAcquired: TMsTscAxNotSafeForScriptingOnUserNameAcquired read FOnUserNameAcquired write FOnUserNameAcquired;
  110.     property OnMouseInputModeChanged: TMsTscAxNotSafeForScriptingOnMouseInputModeChanged read FOnMouseInputModeChanged write FOnMouseInputModeChanged;
  111.     property OnServiceMessageReceived: TMsTscAxNotSafeForScriptingOnServiceMessageReceived read FOnServiceMessageReceived write FOnServiceMessageReceived;
  112.     property OnConnectionBarPullDown: TNotifyEvent read FOnConnectionBarPullDown write FOnConnectionBarPullDown;
  113.     property OnNetworkStatusChanged: TMsTscAxNotSafeForScriptingOnNetworkStatusChanged read FOnNetworkStatusChanged write FOnNetworkStatusChanged;
  114.     property OnDevicesButtonPressed: TNotifyEvent read FOnDevicesButtonPressed write FOnDevicesButtonPressed;
  115.     property OnAutoReconnected: TNotifyEvent read FOnAutoReconnected write FOnAutoReconnected;
  116.     property OnAutoReconnecting2: TMsTscAxNotSafeForScriptingOnAutoReconnecting2 read FOnAutoReconnecting2 write FOnAutoReconnecting2;
  117.   end;


Attempting to use the Lazarus typelib importer has not gone any better. Methods are prefixed with a redundant "On" and many of the necessary properties can't be found, i.e. the above class does not have a Connect method visible even though it should inherit one:

Code: Pascal  [Select][+][-]
  1. TAxcMsRdpClient7NotSafeForScripting = Class(TActiveXContainer)
  2.   Private
  3.     FServer:IMsRdpClient7;
  4.     FOnOnConnecting:TIMsTscAxEventsOnConnecting;
  5.     FOnOnConnected:TIMsTscAxEventsOnConnected;
  6.     FOnOnLoginComplete:TIMsTscAxEventsOnLoginComplete;
  7.     FOnOnDisconnected:TIMsTscAxEventsOnDisconnected;
  8.     FOnOnEnterFullScreenMode:TIMsTscAxEventsOnEnterFullScreenMode;
  9.     FOnOnLeaveFullScreenMode:TIMsTscAxEventsOnLeaveFullScreenMode;
  10.     FOnOnChannelReceivedData:TIMsTscAxEventsOnChannelReceivedData;
  11.     FOnOnRequestGoFullScreen:TIMsTscAxEventsOnRequestGoFullScreen;
  12.     FOnOnRequestLeaveFullScreen:TIMsTscAxEventsOnRequestLeaveFullScreen;
  13.     FOnOnFatalError:TIMsTscAxEventsOnFatalError;
  14.     FOnOnWarning:TIMsTscAxEventsOnWarning;
  15.     FOnOnRemoteDesktopSizeChange:TIMsTscAxEventsOnRemoteDesktopSizeChange;
  16.     FOnOnIdleTimeoutNotification:TIMsTscAxEventsOnIdleTimeoutNotification;
  17.     FOnOnRequestContainerMinimize:TIMsTscAxEventsOnRequestContainerMinimize;
  18.     FOnOnConfirmClose:TIMsTscAxEventsOnConfirmClose;
  19.     FOnOnReceivedTSPublicKey:TIMsTscAxEventsOnReceivedTSPublicKey;
  20.     FOnOnAutoReconnecting:TIMsTscAxEventsOnAutoReconnecting;
  21.     FOnOnAuthenticationWarningDisplayed:TIMsTscAxEventsOnAuthenticationWarningDisplayed;
  22.     FOnOnAuthenticationWarningDismissed:TIMsTscAxEventsOnAuthenticationWarningDismissed;
  23.     FOnOnRemoteProgramResult:TIMsTscAxEventsOnRemoteProgramResult;
  24.     FOnOnRemoteProgramDisplayed:TIMsTscAxEventsOnRemoteProgramDisplayed;
  25.     FOnOnRemoteWindowDisplayed:TIMsTscAxEventsOnRemoteWindowDisplayed;
  26.     FOnOnLogonError:TIMsTscAxEventsOnLogonError;
  27.     FOnOnFocusReleased:TIMsTscAxEventsOnFocusReleased;
  28.     FOnOnUserNameAcquired:TIMsTscAxEventsOnUserNameAcquired;
  29.     FOnOnMouseInputModeChanged:TIMsTscAxEventsOnMouseInputModeChanged;
  30.     FOnOnServiceMessageReceived:TIMsTscAxEventsOnServiceMessageReceived;
  31.     FOnOnConnectionBarPullDown:TIMsTscAxEventsOnConnectionBarPullDown;
  32.     FOnOnNetworkStatusChanged:TIMsTscAxEventsOnNetworkStatusChanged;
  33.     FOnOnDevicesButtonPressed:TIMsTscAxEventsOnDevicesButtonPressed;
  34.     FOnOnAutoReconnected:TIMsTscAxEventsOnAutoReconnected;
  35.     FOnOnAutoReconnecting2:TIMsTscAxEventsOnAutoReconnecting2;
  36.  
  37.     FEventSink:TEventSink;
  38.     procedure EventSinkInvoke(Sender: TObject; DispID: Integer;
  39.           const IID: TGUID; LocaleID: Integer; Flags: Word;
  40.           Params: tagDISPPARAMS; VarResult, ExcepInfo, ArgErr: Pointer);
  41.   Public
  42.     constructor Create(TheOwner: TComponent); override;
  43.     destructor Destroy; override;
  44.     property OleServer:IMsRdpClient7 read FServer;
  45.   Published
  46.     property Align;
  47.     property Anchors;
  48.     property AutoSize;
  49.     property BorderSpacing;
  50.     property ChildSizing;
  51.     property ClientHeight;
  52.     property ClientWidth;
  53.     property Constraints;
  54.     property DockSite;
  55.     property DragCursor;
  56.     property DragKind;
  57.     property DragMode;
  58.     property Enabled;
  59.     property ParentShowHint;
  60.     property PopupMenu;
  61.     property ShowHint;
  62.     property TabOrder;
  63.     property TabStop;
  64.     property UseDockManager default True;
  65.     property Visible;
  66.     property OnContextPopup;
  67.     property OnDockDrop;
  68.     property OnDockOver;
  69.     property OnDragDrop;
  70.     property OnDragOver;
  71.     property OnEndDock;
  72.     property OnEndDrag;
  73.     property OnEnter;
  74.     property OnExit;
  75.     property OnGetSiteInfo;
  76.     property OnGetDockCaption;
  77.     property OnResize;
  78.     property OnStartDock;
  79.     property OnStartDrag;
  80.     property OnStatusText;
  81.     property OnUnDock;
  82.     property OnOnConnecting : TIMsTscAxEventsOnConnecting read FOnOnConnecting write FOnOnConnecting;
  83.     property OnOnConnected : TIMsTscAxEventsOnConnected read FOnOnConnected write FOnOnConnected;
  84.     property OnOnLoginComplete : TIMsTscAxEventsOnLoginComplete read FOnOnLoginComplete write FOnOnLoginComplete;
  85.     property OnOnDisconnected : TIMsTscAxEventsOnDisconnected read FOnOnDisconnected write FOnOnDisconnected;
  86.     property OnOnEnterFullScreenMode : TIMsTscAxEventsOnEnterFullScreenMode read FOnOnEnterFullScreenMode write FOnOnEnterFullScreenMode;
  87.     property OnOnLeaveFullScreenMode : TIMsTscAxEventsOnLeaveFullScreenMode read FOnOnLeaveFullScreenMode write FOnOnLeaveFullScreenMode;
  88.     property OnOnChannelReceivedData : TIMsTscAxEventsOnChannelReceivedData read FOnOnChannelReceivedData write FOnOnChannelReceivedData;
  89.     property OnOnRequestGoFullScreen : TIMsTscAxEventsOnRequestGoFullScreen read FOnOnRequestGoFullScreen write FOnOnRequestGoFullScreen;
  90.     property OnOnRequestLeaveFullScreen : TIMsTscAxEventsOnRequestLeaveFullScreen read FOnOnRequestLeaveFullScreen write FOnOnRequestLeaveFullScreen;
  91.     property OnOnFatalError : TIMsTscAxEventsOnFatalError read FOnOnFatalError write FOnOnFatalError;
  92.     property OnOnWarning : TIMsTscAxEventsOnWarning read FOnOnWarning write FOnOnWarning;
  93.     property OnOnRemoteDesktopSizeChange : TIMsTscAxEventsOnRemoteDesktopSizeChange read FOnOnRemoteDesktopSizeChange write FOnOnRemoteDesktopSizeChange;
  94.     property OnOnIdleTimeoutNotification : TIMsTscAxEventsOnIdleTimeoutNotification read FOnOnIdleTimeoutNotification write FOnOnIdleTimeoutNotification;
  95.     property OnOnRequestContainerMinimize : TIMsTscAxEventsOnRequestContainerMinimize read FOnOnRequestContainerMinimize write FOnOnRequestContainerMinimize;
  96.     property OnOnConfirmClose : TIMsTscAxEventsOnConfirmClose read FOnOnConfirmClose write FOnOnConfirmClose;
  97.     property OnOnReceivedTSPublicKey : TIMsTscAxEventsOnReceivedTSPublicKey read FOnOnReceivedTSPublicKey write FOnOnReceivedTSPublicKey;
  98.     property OnOnAutoReconnecting : TIMsTscAxEventsOnAutoReconnecting read FOnOnAutoReconnecting write FOnOnAutoReconnecting;
  99.     property OnOnAuthenticationWarningDisplayed : TIMsTscAxEventsOnAuthenticationWarningDisplayed read FOnOnAuthenticationWarningDisplayed write FOnOnAuthenticationWarningDisplayed;
  100.     property OnOnAuthenticationWarningDismissed : TIMsTscAxEventsOnAuthenticationWarningDismissed read FOnOnAuthenticationWarningDismissed write FOnOnAuthenticationWarningDismissed;
  101.     property OnOnRemoteProgramResult : TIMsTscAxEventsOnRemoteProgramResult read FOnOnRemoteProgramResult write FOnOnRemoteProgramResult;
  102.     property OnOnRemoteProgramDisplayed : TIMsTscAxEventsOnRemoteProgramDisplayed read FOnOnRemoteProgramDisplayed write FOnOnRemoteProgramDisplayed;
  103.     property OnOnRemoteWindowDisplayed : TIMsTscAxEventsOnRemoteWindowDisplayed read FOnOnRemoteWindowDisplayed write FOnOnRemoteWindowDisplayed;
  104.     property OnOnLogonError : TIMsTscAxEventsOnLogonError read FOnOnLogonError write FOnOnLogonError;
  105.     property OnOnFocusReleased : TIMsTscAxEventsOnFocusReleased read FOnOnFocusReleased write FOnOnFocusReleased;
  106.     property OnOnUserNameAcquired : TIMsTscAxEventsOnUserNameAcquired read FOnOnUserNameAcquired write FOnOnUserNameAcquired;
  107.     property OnOnMouseInputModeChanged : TIMsTscAxEventsOnMouseInputModeChanged read FOnOnMouseInputModeChanged write FOnOnMouseInputModeChanged;
  108.     property OnOnServiceMessageReceived : TIMsTscAxEventsOnServiceMessageReceived read FOnOnServiceMessageReceived write FOnOnServiceMessageReceived;
  109.     property OnOnConnectionBarPullDown : TIMsTscAxEventsOnConnectionBarPullDown read FOnOnConnectionBarPullDown write FOnOnConnectionBarPullDown;
  110.     property OnOnNetworkStatusChanged : TIMsTscAxEventsOnNetworkStatusChanged read FOnOnNetworkStatusChanged write FOnOnNetworkStatusChanged;
  111.     property OnOnDevicesButtonPressed : TIMsTscAxEventsOnDevicesButtonPressed read FOnOnDevicesButtonPressed write FOnOnDevicesButtonPressed;
  112.     property OnOnAutoReconnected : TIMsTscAxEventsOnAutoReconnected read FOnOnAutoReconnected write FOnOnAutoReconnected;
  113.     property OnOnAutoReconnecting2 : TIMsTscAxEventsOnAutoReconnecting2 read FOnOnAutoReconnecting2 write FOnOnAutoReconnecting2;
  114.  
  115.     property Active;
  116.   end;              

If I only access properties which are visible (position and visibility) I receive an access error.

marcov

  • Administrator
  • Hero Member
  • *
  • Posts: 11383
  • FPC developer.
Re: COM Control Creation And FPC
« Reply #8 on: July 26, 2018, 04:49:39 pm »
I don't know that type. But I do know the interface IOleControl is in unit activex.

Probably ToleControl is a basic object implementing that object. That doesn't mean however it is trivial, the comserv unit has had quite some maintainance over the years.

Since Ludo Brands went silent, activity in COM has been low.

guest60499

  • Guest
Re: COM Control Creation And FPC
« Reply #9 on: July 26, 2018, 06:33:29 pm »
Thanks for the tip. Replacing the type makes compilation proceed further but now I receive errors that the accessors are missing.

I suppose the proper course of action is to try to get the Lazarus ActiveX components working. That was my goal all along. I will see what I can do but I do not expect great things. For my purposes it is likely I will move to FreeRDP.

It doesn't look like much new development uses COM or ActiveX. It seems like using COM for C# interop happens occasionally.

marcov

  • Administrator
  • Hero Member
  • *
  • Posts: 11383
  • FPC developer.
Re: COM Control Creation And FPC
« Reply #10 on: July 26, 2018, 06:46:50 pm »
The use of Ole controls was always quite tied to making components for VB6, and that stopped a bit. So now it is more nonvisual.

Phil

  • Hero Member
  • *****
  • Posts: 2737
Re: COM Control Creation And FPC
« Reply #11 on: July 26, 2018, 06:50:34 pm »
I suppose the proper course of action is to try to get the Lazarus ActiveX components working. That was my goal all along. I will see what I can do but I do not expect great things. For my purposes it is likely I will move to FreeRDP.

See if you can get it working as an ActiveX control and use late binding to call it. For example, to use IE as an ActiveX control:

- Drop activexcontainer on form and resize as desired.

- Set its OleClassName to Shell.Explorer.

- Add code to test, eg, a button handler:

procedure TForm1.Button1Click(Sender: TObject);
var
  ie: Variant;
  URL: WideString;
begin
  ie := ActiveXContainer1.ComServer;
  URL := UTF8Decode('https://www.lazarus-ide.org');
  ie.Navigate(URL);
end;


Not sure what OLE class you're interested in using. I see MsTscAx.MsTscAx, MsRDP.MsRDP, etc. in registry.

 

TinyPortal © 2005-2018