com

E_NOINTERFACE returned

I have a COM Client and a COM Server, the COM Server holds an Interface exposed by the client, now the client is actually just an EXE, how do I make sure that the Interface exposed by the client is visible to the Server? Because when I call CoCreateInstance now on that interface in the server I get a E_NOINTERFACE and I suspect it's bec...

Call QueryInterface before CoCreateInstance?

Is the above possible? Can I do this: IUnknown *punk; punk->QueryInterface(IID_MyInterface, (void**)&m_pMyInterface); I thought that this would tell me if the MyInterface is supported m_pMyInterface... ...

CRT types across process boundaries

I'm doing drag/drop out of an activeX control. On drag, I provide a CComQIPtr which has COM methods implemented to pass information to the drop target. On drop, the drop target's process calls my COM methods to get information. Am I not allowed to use CRT types or pointers to CRT types near that interface boundary? I would love for my I...

Failed to create COM object 'name': Catastrophic failure in IIS7 PHP application

I have a PHP app running on IIS7 server 2008. It has a COM object that I'm not able to bind to. The error is... Failed to create COM object 'name': Catastrophic failure ... where 'name' is the name of my COM object. The COM object is designed to read/write registry settings, and I've given it permissions to function to the best of my...

Good way to script regasm and gacutil for a COM Interop DLL on a developer machine

I'm working on a .NET library that is intended to be consumed in a VB6 project. To set up the dll to be used on my developer machine, I use regasm and gacutil, like so: regasm /tlb:MyDll.tlb Mydll.dll gacutil /i Mydll.dll On each subsequent call, I also unregister/uninstall the assembly: regasm /u /tlb:MyDll.tlb Mydll.dll regasm ...

Release com objects at application crash

Is there a way to release com objects at application crash? I have the following code: public class Application : IDisposable { private bool disposed = false; private object realApplication; public void Dispose() { Dispose(true); } private void Dispose(bool disposing) { if (!disposed) {...

OCX component in C# - using and deploying

I am creating C# application that uses OCX component. I have this component from manufacturer of some kind of printer. During installation of their files, foo.ocx was added to my C:\Windows\System32. The only thing I had to do is add reference in Solution Explorer, and point that library in COM tab. Then I took interface: [Guid("XXX")...

COM type library and Interface exposure

When you have a COM client that exposes an Interface for an out of proc COM server to access, do you have to register the type library or .idl file with the system for the server to be able to access the interface? I'm not sure if I can generate a proxy/stub DLL from this client process to register with the system. Does it matter in wh...

Registration Free COM Interop: The application has failed to start because its side-by-side configuration is incorrect

Background. I've got a COM Wrapper assembly called ComWrapper.dll written in C#, and Visual Basic 6 application called Project1.exe. I've added the Project1.exe.manifest file (contents of which are shown below), and I'm getting an error that says "the application has failed to start because its side-by-side configuration is incorrect. ...

Problems with COM object C#

Hi, I have to adjust dll to be COM object (one main class in the class library). This dll has reference to other dlls. When i'm using C# attributes for COM and register the dll, i can't work with this class, the registration register a lot of mess in the registry (few public classes in my class library, that i don't want to expose them...

Replace a COM class implementation at runtime

This is a bit of a long shot but does anyone know how to replace the implementation of a COM class at runtime (or, if it is actually possible)? My problem is that we have a COM DLL out there in the wild but we aren't completely sure which version it is and we don't want to have to do a complete rebuild of the software just to replace th...

E_ACCESSDENIED exception when attaching to an event in a COM server from .NET

I have a C++/ATL COM server that implements IConnectionPoint events. My client is a C# application that attaches to the events. When the COM server is created as a SYSTEM service, the client can properly attach to the event. When the COM server is created as a LocalService service (preferred), then I get an E_ACCESSDENIED exception wh...

Fail to CoCreateInstance an EXE COM server

Hi, I have an EXE COM server (used to elevate our application to a higher integrity level) which is downloaded to %temp% and registered by an ActiveX control. This COM server works pretty well on Vista machines. On Window 7 machines I got something wired: the COM server can be downloaded and registered successfully, but I got the error ...

Is registration-free activation possible for EXE (out-of-process) COM servers?

I know that we can use CoLoadLibrary and DllGetClassObject to get the IClassFactory interface and get the COM component interface without registering the DLL. But what about a COM component in an EXE? Is there a way that I can get a COM component interface from an EXE-type COM server by just providing a different file path? ...

How do I check if a COM dll is registered in C#

I created a Office Add-In in VS 2008, C#, .NET 3.5, and VSTO. It is deployed via ClickOnce. A run-time configuration form executes regsvr32 to register "fooapi.dll" included with the project that can not be registered during instal due to ClickOnce limitations. Is there any prefered way to check and see if "fooapi.dll" is registered duri...

Multiple seach paths for assemblies not in the GAC when using REGASM & COM

I am in the process of creating a .NET assembly that will be registered for COM so that it can be referenced by Microsoft Excel VBA. The assembly references a third-party .NET assembly (that contains some useful classes) that is not in the GAC, however, I have a problem with the deployment of my assembly since the path to the third-part...

IOleInPlaceSiteWindowless::AdjustRect not working?

I am using IOleInPlaceSiteWindowless::AdjustRect to properly capture and release the mouse in a windowless ActiveX control hosted in IE: LRESULT CD3DControl::OnMouseMove(UINT /*uMsg*/, WPARAM /*wParam*/, LPARAM lParam, BOOL& /*bHandled*/) { CRect rc(CPoint(lParam), CSize(0, 0)); HRESULT hr = m_spInPlaceSite->AdjustRect(rc); ...

How to create new com object with parameters using powerhsell?

Hi, I have COM object with few constructors, i'm trying to create new instance and passing parameters to the constructor using powershell 2.0, but i'm getting this error: Parameter set cannot be resolved using the specified named parameters. This is the code: $paramsInfo = New-Object -ComObject 'MyObject.ObjectA' $comObj = New-Object ...

Copy Excel Worksheet from one Workbook to another with Powershell

Hi, I'd like to copy (or move) a worksheet from one workbook to another workbook with Powershell. I had done this before and cant remember how. I think I used CopyTo() funtion. Just to get started. $missing = [System.Type]::missing $excel = New-Object -Com Excel.Application $wb1 = $excel.Workbooks.Add($missing) $wb2 = $excel.Workboo...

Why am I not receiving COM events via Com4J?

I am using Com4J to interact with Microsoft Outlook. I have generated the Java type definitions as per the Com4J tutorial. Here is an example of some code that waits for the user to close an email. // Registers my event handler mailItem.advise( ItemEvents.class, new ItemEvents() { @Override public...