Method ComUtil.GetActiveObject(+ 1 overload)
Overload
Gets a COM object existing in other process and registered in ROT.
public static object GetActiveObject(string progID, bool dontThrow = false)
Parameters
progID (string)
ProgID of the COM class. Example: |
dontThrow (bool)
If fails, don't throw exception but return |
Returns
Exceptions
COMException
|
Remarks
Calls API GetActiveObject.
This process must have the same UAC integrity level as the target process (of the COM object). In script Properties select uac user.
Examples
/*/ uac user; com Outlook 9.6 #ed6988d3.dll; /*/
using Outlook = Microsoft.Office.Interop.Outlook;
var app = (Outlook.Application)ComUtil.GetActiveObject("Outlook.Application");
print.it(app.ActiveExplorer().CurrentFolder.Name);
See Also
Overload(top)
public static object GetActiveObject(in Guid clsid, bool dontThrow = false)
Parameters
Returns
Exceptions
COMException
An object of this type currently is unavailable. Probably its program is not running, or running with a different UAC integrity level. |