Skip to content

Flow documentation · legacy product

CreateOleObject ​

Declaration ​

Function CreateOleObject(const ClassName: string): Variant;

Example ​

pascal
//Instantiating the COM Library to a global variable
procedure OnStartMapEvent(var Value:Variant);
begin
  GLOBAL1 := CreateOleObject(<guidornameofcomlibrary>);
//in other events you can then use properties of the COM Object eg Global1.DoSomething();
end;

//Instantiating the COM Library locally
procedure OnMapEvent(var Value:Variant);
var MyCOMObject : variant;
begin
  MyCOMObject := CreateOleObject(<guidornameofcomlibrary>);
Value := MyComObject.DoSomething;
end;

Description ​

CreateOleObject returns a pointer to an instantiated COM Object. ClassName is either the Guid or name of the COM library you are attempting to load.

It is common to use this call in the OnStartMap of the master data view in the map and assign the result to a GLOBAL Variables. This means the COM library is instantiated only once and can then be used in other events. This is far quicker than re-instantiating the COM library each time the event is called as would occur using local variant variables.

Your COM object references will be released from memory automatically ... you do not need to delete or "free" them in your script.