0

As the title suggest, I can't find that unit.

Is there an equivalent?

I am trying to port a unit from VCL to Firemonkey which contains OleServer in its uses clause, but I can't find any information on Embarcaderos website regarding this problem.

I have also tried to Google it, but no success.

Where can I find TOleServer and/or its unit OleServer that is compatible with Firemonkey?

Or how can I implement that unit in my Firemonkey project?

Aid Vllasaliu
  • 85
  • 2
  • 11
  • Keep in mind that FMX is mainly targeted at cross platform development. OLE is a ms windows technology, so it is no surprise you can't do OLE in Firemonkey. – whosrdaddy Mar 13 '15 at 09:35
  • What you need to do is work out why this unit is being used? Which COM server is being used? – David Heffernan Mar 13 '15 at 10:45
  • @DavidHeffernan it is being used in a set of components which handles Windows Portable Devices, and the components are available in VCL app but not in Firemonkey app. And it doesnt say anything about which COM server is being used, only that the components ancestor is TOleServer – Aid Vllasaliu Mar 13 '15 at 13:58
  • Do you know what the code is doing? All the same, it doesn't sound like it's very easy to consume com servers from fmx if you are compelled to haul in vcl. I might be tempted to use a modified OleServer unit that doesn't use vcl. – David Heffernan Mar 13 '15 at 14:02
  • Why use Firemonkey if you're targeting Windows? – Jerry Dodge Mar 13 '15 at 15:06
  • @JerryDodge I'm working on a multiplatform app, but depending on the target OS it different parts of code will be executed using compiler directives. Right now I'm working on the Windows code. Also Firemonkey provides good GUI framework for animations and such. – Aid Vllasaliu Mar 13 '15 at 16:07
  • 1
    A lot of the unit names have changed from before. If you use the "Find in Files" window in Delphi to search the source code, you will see that TOleServer is in VCL.OleServer.pas. Usually you can use non-visual Windows units in Firemonkey in a Windows application. Of course, there is no such thing as COM OLE in OSX. – Doug Rudd Mar 24 '15 at 05:05

2 Answers2

1

Hi i have the same problèm before and i made change in OleServer

  1. Copy Vcl.OleSever to your project and rename it to FMX.OleServer
  2. in implementation section do change like this:

implementation
uses
  FMX.Controls;

resourcestring
  sNoRunningObject = 'Unable to retrieve a pointer to a running object registered with OLE for %s/%s';

  1. at the initialization section change to FMX.Controls.TControl

initialization
  GroupDescendentsWith(TOleServer, FMX.Controls.TControl);
end.

  1. Finally rename VCL.OleServer to FMX.OleServer in your imported library unit
Mazighus
  • 21
  • 5
0

Indeed the main issue with compiling TLB (typelibrary) units for COM/OLE Servers seems to be some unit renaming that has occured. Ideally the Delphi IDE should detect this automatically and fix it.

Based on Doug Rudd's comment above I fixed my "uses OleServer" to "uses Vcl.OleServer" in my TLB unit.

Since there's a "source" folder under Delphi installation folder even for the Pro version now (at least at 10.2.2 Tokyo version that I'm currently using), I could also easily spot (using GrepWin free tool) where the "EmptyParam" that was causing my TLB to not compile had gone. It is under System.Variants unit that one also needs to use in their TLB (before it was in System so you didn't need to use some unit for it).

Guess I could have imported the COM/OLE Server again to make new TLB import unit, but since it was hand-ended (to remove using of "Graphics", "StdVcl" and "OleCtrls" units that were bloating the executable size in older versions of Delphi) and that hand-edited imported TLB used to work fine for a command-line application, I didn't have any reason to reimport the Type Library.

You can see the changes I did to make my XSLer tool work with the latest Delphi at https://github.com/Zoomicon/tranXform/commit/e99f42049b8a4c1534d9edb78ed5e6493e6e5786. That XSLer command-line tool is using MSXML (Microsoft XML) automation server.

George Birbilis
  • 2,782
  • 2
  • 33
  • 35