GetActiveObject(ProgId: String): Variant;
ProgId. Programmatic identifier of the application, the access to the instance of which the user needs to get.
The GetActiveObject allows access to the running instance of the application, which identifier is passed as the ProgId input parameter.
Global programmatic identifier specified in the ProgId parameter can be obtained from the operating system registry: the global universal identifier of created application must be found in the HKEY_CLASSES_ROOT\CLSID section. The application name is a default value for the section of a global unique identifier. The found section contains the ProgID subsection, which default value is the programmatic identifier of the application.
If multiple application instances are running in the operating system, the method returns the first running application instance.
Sub UserProc;
Var
v: Variant;
Begin
Try
v := Variant.GetActiveObject("Excel.Application");
v := v.GetProperty("Name");
Except
Debug.WriteLine(Could not get an object name);
End Try;
End Sub UserProc;
After executing the example, if the Excel application is open, the "v" variable will contain the name of this application.
See also: