jaklug
Posts: 11
Joined: 2018-08-28
|
I'm trying to use the WindowActivate event for Microsoft Project, but I can't figure out the type to cast hostObj to. Can you help me?
Thank you,
Joe |
|
jaklug
Posts: 11
Joined: 2018-08-28
|
I've tried casting hostObj to MSProject.Project like this:
var currentProject = (MSProject.Project)hostObj;
I get this error:
System.InvalidCastException
HResult=0x80004002
Message=Unable to cast COM object of type 'System.__ComObject' to interface type 'Microsoft.Office.Interop.MSProject.Project'. This operation failed because the QueryInterface call on the COM component for the interface with IID '{00020B00-0000-0000-C000-000000000046}' failed due to the following error: No such interface supported (Exception from HRESULT: 0x80004002 (E_NOINTERFACE)).
Source=<Cannot evaluate the exception source>
StackTrace:
<Cannot evaluate the exception stack trace>
I'm using the latest download of Add-in Express and the Microsoft Project Online Desktop Client (Office 365). |
|
Andrei Smolin
Add-in Express team
Posts: 18793
Joined: 2006-05-11
|
Hello Joe,
Try to cast to Project.Window.
Also, you can add a reference to Microsoft.VisualBasic and call Microsoft.VisualBasic.Information.TypeName({an object reference here}) to get a string representing the type name of the object.
Andrei Smolin
Add-in Express Team Leader |
|