com

How to share COM objects between 2 processes?

I want Application1.exe to instantiate an instance of its Item class. I want Application2.exe to call GetPrice() on this object. I have followed steps 1-7 on the following website: http://www.codeguru.com/Cpp/COM-Tech/activex/tutorials/article.php/c5567/ This is what I have so far. Application1's main looks like this: CoInitialize( N...

How to use IMalloc::Free ?

I'm using ICommandText::GetCommandText method. According to the MSDN documentation (http://msdn.microsoft.com/en-us/library/ms709825(v=VS.85).aspx) I need to use IMalloc::Free to release the memory allocated for LPOLESTR *ppwszCommand output parameter. How do I use this interface to do that? ...

python win32com Causes Program crash

I wrote program to control iTunes by monitoring keystrokes from with pyHooks and then interfaceing with the iTunes COM interface. The program works fine, the only problem I have is when I try to compile it with py2exe. The program always crashes with this traceback: Traceback (most recent call last): File "threading.pyc", line 527, i...

Why can't we use "virtual inheritance" in COM?

I have read some vague statement that virtual inheritance doesn't provide the memory structure required by COM, so we have to use the normal inheritance. Virtual inheritance is invented to handle the diamond problem. Could someone show me an illustration of the difference of memory structure details between this two inherit approaches? ...

using C# DLL from C++: problem with functions with strings as parameters

Starting from this example: http://support.microsoft.com/kb/828736 I have tried to add a test function in my C# DLL which takes strings as parameters. My C# DLL code is as follows: namespace CSharpEmailSender { // Interface declaration. public interface ICalculator { int Add(int Number1, int Number2); int StringT...

C# late binding to com/activeX server, trouble with one method

Hi I am fairly new to Interop/Com/ActiveX etc, so bear with me. I am late binding into a com/activex (not sure which one) server (basically an exe not a dll). I am successfully using all the methods in that server except for one, here is the description: VT_INT GetLastCCTError (variant *error_string); Description: This funct...

how to disable delete Data when i compile application in visual studio using Ado.net?

how to disable delete Data when i compile application in visual studio using Ado.net? Microsoft Access 2010 ? ...

COM class Returning byte[] in .NET - Whether to release memory or not

I have a COM component having a MyDataObject class. There is a method with the following signature: HRESULT MyDataObject::GetData(long Format, VARIANT* retval) This COM object is used in a .NET application and the method returns either a string or byte array depending on Format value. The returned value is converted to a byte[] in .NE...

WPF App - MFC App interoperation

I have a small WPF application. I wish to integrate it within our exisiting systems. I have two COM servers implemented as MFC MDI apps, lets call them COM_Srv1 and COM_Srv2. COM_Srv1 needs to call a method of WPF app, say StartTask. On Task Completion WPF app notifies the COM_Srv1 app WPF app may need to invoke a method on COM_Srv2 to...

What is the proper way to manage large IStreams?

I am writing a C# class library to transfer large volumes of data through COM automation using an IStream. It uses the CreateStreamOnHGlobal API call to create the stream, and the methods within System.Runtime.InteropServices.COMTypes.IStream to work with it. My question is, when transferring large volumes of data, what is the best way...

Register a BHO through an NSIS installer

I have an IE BHO which I was packaging through the Visual Studio setup and deployment project. I now want to the package it through an NSIS installer. My BHO was registering in the following way: [ComRegisterFunctionAttribute] public static void Register(Type t) { string guid = t.GUID.ToString("B"); Registr...

Implementing a Windows Explorer extension view interface

I have a Visual Studio 2008 C++ ATL project that is a namespace extension for Windows Explorer. In the tool bar rebar for Windows Explorer in Windows XP, there is an icon labeled "views". In a normal view, it creates a drop-down menu that allows the user to select "Thumbnails", "Tiles", "Icons", "List", or "Details" as the view type. ...

How to write a COM EXE for Win32 using Tcl and TclApp?

I would like to think it possible to use TclApp to create a Win32 EXE that could be used as COM server EXE. Has anyone tried this, or is it too horrible an idea to seriously consider? Basically, I want to do in Tcl what I can already do using PerlCtrl. ...

Making object model available via Automation in Delphi: what’s the easiest way?

We’re rewriting a calculation core from scratch in Delphi, and we’re looking for ways to let other people write code against it. Automation seems a fairly safe way to get this done. One use we’re thinking of is making it available to VBA/Office, and also generating a .NET assembly (based on the Automation object, that's easy). But the...

COM component crash

When you have a piece of software that runs an out of process COM server and the COM server crashes, will it show a message (let's say its an unhandled exception) to the user or what will happen? Also, will the COM client crash too, knowing that this client relies on this COM Server quite a lot? What's the behaviour in regards COM Serv...

Pass multidimensional (safe)array from C# to COM

I have a COM object that takes a 0 bounded safearray of two dimensions. I need to pass this array into my C++ COM object. I can pass the VB6 multidim arrays into the C++ side without a problem, but I have no idea how to set this up in C# so that it will be marshalled correctly. Does anyone know the steps to set up a mulitidimensional arr...

Excel Interop Manipulate ScrollBar on Worksheet

I'm opening an excel worksheet using the Microsoft.Office.Interop.Excel COM interface. I'm trying to adjust the "maximum" value of a scroll bar embedded into a worksheet. I can find the scroll bar with the following: app = new Excel.Application(); wb = app.Workbooks.Open( Path.GetDirectoryName(Application.ExecutablePath)+@"\template...

regasm and tlb (registering a .NET library for COM interop)

I have .NET assembly with one public class and several private classes. I am trying to register it for COM interop so that I can call it from VBA, using the following command: regasm /tlb foo.dll /codebase Subsequently, when I open up the .tlb file in Visual Studio's "object browser", I see that the library does not expose any types. ...

Fastest way to write cells to Excel with Office Interop?

I am writing a function to export data to Excel using the Office Interop in VB .NET. I am currently writing the cells directly using the Excel worksheet's Cells() method: worksheet.Cells(rowIndex, colIndex) = data(rowIndex)(colIndex) This is taking a long time for large amounts of data. Is there a faster way to write a lot of data t...

What good .NET/COM book are out there?

I've been working as .NET developer for a few years now and have no other windows development experience worth noting. Now I'm in a position where I have to use and maintain .NET code that uses older VB6 code. Other people are maintaining and replacing this code but for the next couple years I'll have to live with it. As far as I can t...