com

Monitor a COM port already in use.

Is it possible to read from a COM port already in use on Windows XP? I would like to see the communication between some software and a device plugged into a serial device. I wrote a small program using C# to monitor the COM, but once it's in use by the other device it will not let you open it again. How can one monitor a COM port already...

How can we expose a .NET public const to COM interop

For historical reasons, we need to expose string constants in .NET through COM interface. We managed to expose ENUM but we can't find a way to expose string const. We try the following code : <ComClass(ComClass1.ClassId, ComClass1.InterfaceId, ComClass1.EventsId)> _ Public Class ComClass1 #Region "COM GUIDs" ' These GUIDs provid...

Question about registering COM server and Add Reference to it in a C# project

I build a COM server in raw C++. And I have some trouble when adding reference to it. Here is the procedure: (1) write an IDL file to define the interface and library. (2) use msidl.exe to compile the IDL file to necessary .h, .c, .tlb files. (3) implement the COM server in C++ and build a .dll file. (4) add the following registry entr...

How to make windows media player go to previous song in playlist?

Hi, everyone! I am writing a simple Windows app in c++, that will be able to send commands to windows media player. My problem is that I want my app to move to the previous song in the playlist. IWMPControls::previous() seems to do the job, but its behavior differs from what is written in msdn. In fact this function rewinds current med...

"Could not load file or assembly" error on trying to access auxillary assemblies from COM

We have the project structure as follows: COMExposedCCW.dll -refers-> BusinessLayer.dll -refers-> Utils.dll COMExposedCCW.dll -refers-> Utils.dll The COMExposedCCW.dll has been registered for COM interop. From the COM application we can successfully create the CCW object and access its properties, but when we try to invoke methods th...

E_ACCESSDENIED on CoCreateInstance

Here is a code snippet #include "stdafx.h" #include <tchar.h> #include <windows.h> #include <dshow.h> #include <ExDisp.h> int _tmain(int argc, _TCHAR* argv[]) { CoInitialize(NULL); HRESULT hr = S_OK; DWORD err = 0; // Try to create graph builder IGraphBuilder* pGraph = 0; hr = CoCreateInstance(CLSID_FilterGraph,...

CComPtr CoCreateInstance returns 0x80070582 (Class already exists.)

I have a StartComObjects function called when the user presses the Login button and a StopComObjects function called when the user presses the Cancel button. The StartComObjects function uses CComPtr.CoCreateInstance to create the COM object and sets up some connection points using AfxConnectionAdvise. When the user presses the Cancel ...

Passing a SAFEARRAY from C# to COM

I use 3rd party COM to find faces in a picture. One of the methods has the following signature, from SDK: long FindMultipleFaces( IUnknown* pIDibImage, VARIANTARG* FacePositionArray ); Parameters: pIDibImage[in] - The image to search. FacePositionArray[out]- The array of FacePosition2 objects into which face informa...

Generate an ID via COM interop

At the moment, we've got an unmaintanable ball of code which offers an interface to a third party application. The third party application has a COM assembly which MUST be used to create new entries. This process involves two steps: generate a new object (basically an ID), and update that object with new field values. Because COM interop...

0x80040115 when trying to retrieve PR_DISPLAY_NAME

My native raw C++ program uses MAPI to traverse the tree in the Exchange Server. Sometimes when I call HrGetOneProp() on a IMAPIFolder* pointer to retrieve PR_DISPLAY_NAME it fails with HRESULT 0x80040115. It only happens for one particular folder, all other folders names are retrieved allright. Outlook 2003 running on the same machine...

Visio COM Add-in question.

I was installing an Add-in to Microsoft Visio. The Add-in gets installed on the development PC and target PCs. I didn't do anything related to trusting of the Add-in or the CAS related settings as described in some of the VSTO Add-in pages or common Add-in related pages. I was able to see the Add-in listed in the Trust Center with the ty...

Getting COM object to run in Vista

We expose an interface to our simulation software using a COM/ActiveX object. This worked just fine in XP, but in Vista, we get "Error 429: ActiveX can't create object" when a VB client executes CreateObject(). The COM object has been registered by hand so that the Vista Registry is identical to XP's Registry. I run the VB interface...

Exposing C# COM server events to Delphi client applications

My question is very similar to these two: http://stackoverflow.com/questions/1140984/c-component-events http://stackoverflow.com/questions/1638372/c-writing-a-com-server-events-not-firing-on-client However, what worked for them is not working for me. The type library file, does not have any hints of events definitions, so Delphi doesn...

Need to call COM component using reflection in .NET

I need to determine the COM component(unmanaged code) type and invoke the exposed interface's methods using reflection in C# at runtime. First What member of "Type" tells that type is COM component and we can take CLSID at runtime? Is Type.COMObject? I need to call methods of exposed interfaces as they called in unmanaged code using C...

HRESULT of 0x806D0005 from Microsoft's Dia2Lib

I'm trying to read a PDB file into a C# application. When I call loadDataFromPdb or loadAndValidateDataFromPdb with a file that I know exists, I get an HRESULT of 0x806D0005. Unfortunately, I have no idea what that means. I have the list of possible results [here](http://msdn.microsoft.com/en-us/library/2008hf0e(v=VS.80).aspx) but I'm af...

Get name of active Excel workbook from Python

I am trying to write a Python script that will access and modify the active Excel workbook using the Excel COM interface. However, I am having difficulty getting this to work when there are multiple Excel instances running. For example, the code import win32com.client xl = win32com.client.Dispatch("Excel.Application") print(xl.ActiveWo...

Is there a way to create a new instance for IRequestDictionary and IStringList on .NET?

We are working on a C# DLL that stores the values of a Classic ASP Session. Everything is okay but some QueryStrings being stored in Session. Problem is: we are able to read the QueryString from the DLL using IRequestDictionary and IStringList, but we can't find a way to recreate them the next time a page ask for them. We have stored a...

Getting ReportAvOnComRelease Exception when using 3rd party COM

I am a new C# programmer and have created an application which uses a 3rd party COM object to track telephone call recordings from a call recording server. The creator of the COM software is also the vendor who makes the call recording software, so you would think it should work. I have been on many phone calls and code reviews with thei...

java-COM interop: Implement COM interface in Java

How can I implement a vtable COM interface in java? In the old days, I'd use the Microsft JVM, which had built in java-COM interop. What's the equivalent for a modern JRE? Answers to a similar SO question proposed JACOB. I've looked at JACOB, but that is based on IDispatch, and is aimed at controlling Automation serers. The COM interfa...

Why does my call to Activator.CreateInstance intermittently fail?

I'm using the following code to access the Windows Explorer Shell's band site service: Guid GUID_TrayBandSiteService = new Guid(0xF60AD0A0, 0xE5E1, 0x45cb, 0xB5, 0x1A, 0xE1, 0x5B, 0x9F, 0x8B, 0x29, 0x34); Type shellTrayBandSiteService = Type.GetTypeFromCLSID(GUID_TrayBandSiteService, true); site = Activator.CreateInstance(shellTrayBandS...