com

How do I reliably tell that two Inspector references point to the same inspector instance?

[continued from Is there a way to tell whether two COM interface references point at the same instance?] I've got references to Inspector objects from two different sources and need to be able to tell which item from one source corresponds to which item from the other source. However, none of the approaches I have been able to come up w...

Installer::OpenDatabase() produces a type error with msiOpenDatabaseModeTransact.

The following code produces an error hr=0x80020005 (wrong type). #import <msi.dll> using namespace WindowsInstaller; main() { ::CoInitialize(NULL); InstallerPtr pInstaller("WindowsInstaller.Installer"); DatabasePtr pDB = pInstaller->OpenDatabase( "c:\\foo\\bar.msi", msiOpenDatabaseModeTransact); } I think...

Retrieving product information from an unmanaged executing application in C#/.NET

In C#, it is possible to retrieve assembly related information like product name, version etc using reflection: string productName = Assembly.GetCallingAssembly().GetName().Name; string versionString = Assembly.GetCallingAssembly().GetName().Version.ToString(); How do I do the equivalent if the executing assembly is written in unmanag...

CComPtr CoCreateInstance() fails

I have a COM .dll registered successfully with regsvr32 but somehow CoCreateInstance() fails to create one of its interfaces. Is there a freeware tool which can determine the reason for the failure? ...

Fatal Execution Engine Error (79FFEE24) (80131506)

I'm encountering problems with my .NET Framework 3.0 SP1 application. It is a C# winforms application communicating with a COM exe. Randomly either the winforms app or the COM exe crashes without any error message and the event log contains this entry: [1958] .NET Runtime Type: ERROR Computer: CWP-OSL029-01 Time: 11/25...

COM Control colour(color) bug/problem when embedded in PowerBuilder

We have built some .NET controls, and we are using them as COM controls in a PowerBuilder application. They (mostly) consist of controls with other controls on them, some other of our custom controls, some from DevExpress. All of ours inherit from a common base - and this has the DevExpress LookAndFeel control on to ensure that we can e...

COM Registration without Version Identifier

Is it possible to register a COM interface independent of assembly version? Right now I get a registry key like MyIfaceName, Version=1.0.3259.17799, Culture=neutral, PublicKeyToken=1234567890abcdef But since the assembly has auto-versioning (1.0.*.*), every day I do a new build the COM-iface needs to be re-registered. How would I re...

Use custom font with a COM Object in .NET

I am trying o load a custom font in C#, so it is usable by COM libraries (like ESRI) and by GDI+. I want to load the font from disk and don't want to install the font on the system. COM font is of type stdole.IFontDisp. EDIT: using in AddFontResourceEx combination with the PrivateFontCollection solves the issue. ...

What is the C++ equivalent to GetObject in JavaScript and VBScript?

What is the C++ equivalent to GetObject in JavaScript and VBScript? The closest match I found to my question is: http://codewiz51.blogspot.com/2008/06/vb-script-getobject-c-api-cogetobject.html However the sample use an unexisting interface and asking for the IUnknown returns null. Did someone have an example that works? ...

What's the difference between BSTR and _bstr_t ?

Anyone can explain the difference between types mentioned above and some sample usage to clearly explain the difference between the two? Any help would be highly appreciated! Note: this question is a spin-off from this other question ...

Variable/Ram viewer for .NET?

I'm using Office Automation in .NET. It is leaving behind the excel.exe program. I know the fix - it is all about explicitely defining the variables. Once defined, I can properly de-allocate the ram and the GC will clean them up. The problem is, I have literally thousands of lines of code to go through. So I'm wondering: Is there some s...

WindowsIdentity Token in Legacy ASP

I've created a .Net library at work that is used by all of our developers. The security part of it uses Microsoft AzMan for the security backend. In order to create a security (AzMan) ClientContext I have to pass it a token value (as a uint). This is all fine an dandy until I needed to make a COM wrapper for our common library so some of...

Getting Vista/Windows Search/propsys.dll properties from the shell in managed code

Has anyone managed to do this? I tried making a managed wrapper class for IPropertyStore but am getting AccessViolationExceptions on the methods (i.e. IPropertyStore::GetValue) that take a pointer to PROPVARIANT (rendered as a MarshalAs(UnmanagedType.Struct) out parameter in my managed version) Probably my understanding of COM and inte...

Need skeleton code to call Excel VBA from PythonWin

I need to invoke a VBA macro within an Excel workbook from a python script. Someone else has provided the Excel workbook with the macro. The macro grabs updated values from an external database, and performs some fairly complex massaging of the data. I need the results from this massaging, and I don't really want to duplicate this in ...

IDebugControl::WaitForEvent works once then returns E_HANDLE

I'm trying to make a small tool that makes use of the Debugger Engine API, but I'm having very limited success. I can get my IDebugClient and IDebugControl instances, and from there I am able to attach into an already running user process. I then enter a main loop where I call WaitForEvent, OutputStackTrace, SetExecutionStatus(DEBUG_ST...

C# interop: excel process not exiting after adding new worksheet to existing file

I've read many of the other threads here about managing COM references while using the .Net-Excel interop to make sure the Excel process exits correctly upon exit, and so far the techniques have been working very well, but I recently came across a problem when adding new worksheets to an existing workbook file. The code below leaves a z...

How do I call .NET code (C#/vb.net) from vbScript?

I imagine I can compile a C# DLL and then expose it as a COM object so that it can be CreateObject'd from VBscript. I'm just not sure the steps involved in doing this... ...

In C# how could I listen to a COM (Serial) Port that is already open?

I am using a program that talks to my COMM port, but I have made another program that I want to "sniff" the comm port messages and perform it's own actions against those messages in addition. Is this possible in .NET c#? ...

Access x86 COM from x64 .NET

I have an x64 server which, since my libraries are compiled to AnyCPU, run under x64. We are needing to access a COM component which is registered under x86. I don't know enough about COM and my google searches are leading me nowhere. Question: Can I use a symbolic registry link from x64 back to x86 for the COM component? Do I need t...

How do I use a 32 Bit COM object from a 64 bit process?

I Use Jacob (JAVA COM Bridge) on a 64 Bit Machine and want to load COM Objects from a 32 bit DLL. How can I do that? ...