[lnkForumImage]
TotalShareware - Download Free Software

Confronta i prezzi di migliaia di prodotti.
Asp Forum
 Home | Login | Register | Search 


 

Forums >

microsoft.public.dotnet.framework.interop

GetActiveObject and E_NOINTERFACE

jhh

5/8/2007 12:08:00 PM

I just got my first box running Vista. (yihaa!)
My happiness didn't last long - my code broke.

This snippet works in Windows XP but not in Vista.


TransFleet.Application application = null;
Object appObject = Marshal.GetActiveObject("TransFleet.Application");
application = (TransFleet.Application)appObject ; <--Throws Exception


Exception:
Unable to cast COM object of type 'System.__ComObject' to interface
type 'TransFleet.Application'. This operation failed because the
QueryInterface call on the COM component for the interface with IID
'{33E33762-C8AD-4759-B879-4529475A5B8E}' failed due to the following
error: No such interface supported (Exception from HRESULT: 0x80004002
(E_NOINTERFACE)).


Does anybody have some idea what is happening?

Jon H

1 Answer

jhh

5/10/2007 6:19:00 AM

0

Here is the typelib for the COM object I'm trying to get:

[
uuid(E9AFFC5D-55F9-4F21-9850-659862BA11AA),
version(1.0)
]
library TransFleet
{
// TLib :
// TLib : OLE Automation : {00020430-0000-0000-C000-000000000046}
importlib("StdOle2.tlb");

// Forward declare all types defined in this typelib
dispinterface IApplication;
dispinterface I_OrderEngine;

[
uuid(33E33762-C8AD-4759-B879-4529475A5B8E)
]
dispinterface IApplication {
properties:
methods:
[id(0x00000001)]
IDispatch* GetOrderEngine();
};

[
uuid(520406AE-B295-46BE-AC33-7E3B8EFE92D7)
]
coclass Application {
[default] dispinterface IApplication;
};

[
uuid(32C068AB-9604-4E1E-A87E-8EB5B6F03C10)
]
dispinterface I_OrderEngine {
properties:
methods:
[id(0x00000001)]
void SetOptimizerResult(BSTR resultXml);
};
[
uuid(24583300-FBD4-431E-9F40-24FB2318248E)
]
coclass OrderEngine {
[default] dispinterface I_OrderEngine;
};
};