0

I am trying to revive and compile some old sources under XE2.

There's routine that uses 'ToolServices.GetUnitCount' which is defined in ExptIntf.pas (which is deprecated) as ToolServices: TIToolServices = nil;

And, TIToolServices is defined in ToolIntf.pas (which is also deprecated) as TIToolServices = class(TInterface)

And, finally, GetUnitCount is described as "returns the current number of units belonging to the project".

Question is this: How can I (without the use of ExptIntf.pas or ToolIntf.pas) get the current number of units belonging to the project?

TLama
  • 75,147
  • 17
  • 214
  • 392
Adem
  • 265
  • 3
  • 10

2 Answers2

1

The proper response depends on what your code does, but good candidates may be:

  • IOTAProject40

    { Return the number of owned modules }
    function GetModuleCount: Integer;
    { Return the Indexed owned Module Info }
    function GetModule(Index: Integer): IOTAModuleInfo;
    { Return the Project options }
    
  • IOTAProject140

    { Returns a list of fully qualified file names.  This will contain files
      that do not show up in the project manager, for example, the project's
      .res file }
    procedure GetCompleteFileList(FileList: TStrings);
    

Both are ancestors of the IOTAProject interface, so you have both flavors at hand. To use the Open Tools API, you must use the ToolsAPI unit. Take a look at the source\ToolsAPI folder of your Delphi installation.

jachguate
  • 16,976
  • 3
  • 57
  • 98
0

There's documentation in the XE2 and XE3 help files about 'Extending the API', that gives you info about working with modules and files and working with Editor resources. The demo for the'EditorViewAPI' might be helpful to you. All of the services are available through the ToolsAPI and IOTAServices interfaces. There's considerably more documentation and samples than there were with earlier versions. The EditorViewAPI is an actual installed sample app that you can experiment with to see how things work.

RobertFrank
  • 7,332
  • 11
  • 53
  • 99
Ken White
  • 123,280
  • 14
  • 225
  • 444