com

tlbexp.exe changes method names' case

I have a rather strange problem. I am exporting an interface from a C# library to COM. I have enabled the 'register with COM' project setting, so it calls tlbexp.exe to make the type libs. We use camel case on our method names and I noticed that the exported type library changes these any method that happens to coincide with a class nam...

MessageBox in Out-of-Process COM Server

When you have a console based client and a COM Server, can you call ::MessageBox(...) from the COM Server and expect it to work? ...

Error DV_E_FORMATETC when asking for CFSTR_PRINTERGROUP - Windows 7

WI have a windows shell extension which adds menu items to the printer menu when the printer is right-clicked. The code works fine in Windows 2000, XP, Vista, but in Windows 7 the call to GetData() fails with DV_E_FORMATETC. I've found various threads regarding this but they all appear to be VB/asp related. The FORMATETC and STGMEDIUM st...

_bstr_t to char pointer and calling atof(...)

Is this code not going to produce an error: _bstr_t text=n.GetText(); atof((char*)text) Where text is a double value. I know that the _bstr_t produces a const char* in the conversion; so I'm not sure if the atof() is going to work? ...

COM Multi-threaded architecture on multi core machine

How does COM ensure that on a multi-core machine, it stays in Sync if you have a COM out-of-proc server and a COM client, relying on each other, that things don't get mangled if you're running it on a multi-core architecture? ...

checking for failed new

why does this ATL/COM code check for successful alloc? I would have expected a custom allocation to be visible through CoGetALloc or some such api. A standards-conforming C++ runtime should be throwing std::bad_alloc, but then again maybe the allocator has indeed been traded out for a non-throwing impl. DDClientData* pNewData = new DDCl...

Linux acting as USB device

I am working on an embedded Linux platform and I have need to transfer data between the platform and a PC. The embedded Linux has a usb device port (like a printer), so this is the means by which transfers would take place. I envision the easiest way to integrate Linux with the software already on the PC is to have the Linux device appea...

What is the difference between pInvoke and COM Interop?

Let us say that I am accessing a third-party library, for which the documentation states that I can use pInvoke or create an interop library and use COM. What is the difference between these two techniques, and why might I choose one over the other? ...

How to implement Outlook Express alike address field control

Hi All, I was thinking about inserting some object (button, panel or static text) into textctrl, like Outlook Express does this. You can see from a pic "group1" is an object, you can double click on it, when you delete it, it gets deleted the whole text not just a part of it. I made some research and this text field is just a sim...

Building ActiveQt (COM) applications with MinGW

I am using Qt 4.6.3 with MinGW on Windows to build Qt apps and now need to add a COM interface to my application. I enabled ActiveQt but was getting post-link errors because I was missing a copy of the MIDL compiler. I downloaded a copy of the latest MS Windows SDK, which includes MIDL, but now MIDL complains it cannot find cl.exe. Th...

How to translate RPC_STATUS into HRESULT?

In my COM component I need to translate all errors into the most suitable HRESULT values possible. Currently if I call some RPC interface method (I call a MIDL-generated stub that in turn calls NdrClientCall2()) and the call fails I return E_FAIL which is not very convenient. There's so-called facility in HRESULT. Can I use this? I tri...

Strange consequences of "ref" keyword in C# to COM interop

Consider an excerpt from code that can be found here: namespace WinSearchFile { public class Parser { [DllImport("query.dll", CharSet = CharSet.Unicode)] private extern static int LoadIFilter (string pwcsPath, ref IUnknown pUnkOuter, ref IFilter ppIUnk); [ComImport, Guid("00000000-0000-0000-C000-000000...

Windows 7, VS2010, .NET and AxMSCommLib

I have a project that is referencing the AxMSCommLib in VS2010 C#.. My Windows 7 Dev machine doesn't have or can't find this reference. Does anyone have any info on where to get this reference to make it work? ...

AxMSMAPI Windows 7 C# .NET Interop Missing

I have a project that is referencing the AxMSMAPI in VS2010 C#.. My Windows 7 Dev machine doesn't have or can't find this reference. Does anyone have any info on where to get this reference to make it work? ...

Passing DataTable over COM into R

Hello, I am trying to pass data from SQL, to C#, then to an R server for data analysis then back to my web application; however, the COM interface that I am using does not allow complex data types to be passed between C# and R (no data tables). I have gotten it to work in the past by using the following code: int count = dataTable....

Esoteric JScript hosting problem: where is the error code when IDispatch::Invoke returns SCRIPT_E_PROPAGATE?

Our application hosts the Windows Scripting Host JScript engine and exposes several domain objects that can be called from script code. One of the domain objects is a COM component that implements IDispatch (actually, IDispatchEx) and which has a method that takes a script-function as a call-back parameter (an IDispatch* as a parameter)...

Special exception in CoUninitialize

What could be the possible causes of exception in calling CoUninitialize(). Our product is using COM and some of WER crash reports are pointing to CoUnInitialize(). WER systems name it as Special Exception. Any pointers? ...

COM Client/Server cross 64/32 bit processes

On a 64-bit machine: Can a 64-bit application call a COM server (out proc) which is running in 32-bit process? What about vice versa? (32 bit app calling 64-bit COM out proc server) Thanks! ...

regenerating connection point methods

I've created a connection point interface _IPlayerEvents. I've added a couple of methods OnConnect() OnDisconnect() I've built the project, and VS2008 has generated code in the CProxy_IPlayerEvents class: HRESULT Fire_OnConnect(){...} HRESULT Fire_OnDisconnect() {...} Now I've added a further method to the _IPlayerEvents interface...

Convert Smart Device Dll to ActiveX control for Windows Mobile

I am using C# and Visual Studio 2008. I have a class that will turn on the scanner of my Windows Mobile Device and then will capture the read of the scanner when pressed. It will also shut down appropriately and cleanly. I am using a vendor provided SDK to do a lot of the heavy lifting. I have this working correctly in a Mobile App, b...