interop

Is it possible to prohibit putting my in-proc component into COM+?

I have an ATL C++ in-proc COM component. This component is not for external use - I only need it for use in our application. Once in a while users put it into COM+ and this leads to all sorts of weird errors - "Access denied", etc which I'd like to just never hear about. The best way would be to do something that would prohibit putting ...

IPhotoAcquire IPhotoAcquireSource Exception when downloading photo

I'm writing a program using c# to download photos from a digital camera attached to a PC running vista. The camera has a 2GB SD card with a small number of pictures on it. So far I am able to detect the camera and enumerate the pictures, but when I try to download them to a user specified folder, I get the following exception "Not eno...

Sync system time to domain controller using .NET code

I have time based tests to run that require changing the system time multiple times during the test. I want to be able to resync the time to the domain controller time at the end of the test. I there any way to do that using .NET code (C#). I am changing the time using the p-invoke function found in: http://stackoverflow.com/question...

Access .NET generic objects from VBA

My .net code has an object with a number of generic properties. This object is returned to the VBA code. All the non-generic properties are working well, but I also need to access the generic values. Is there a way to do it from VBA? [ClassInterface(ClassInterfaceType.AutoDual)] public class Obj { public string GetProp1() {...} ...

Is there a way to programmatically add a digital signature to a VBA Macro in a word document?

Is there a way to programmatically add a digital signature to a VBA Macro in a word document using C# or VB.Net? There are some similar questions asked already; however, none that I could find answer my question: http://stackoverflow.com/questions/1201195/how-to-programmatically-remove-the-digital-signature-from-vba-macros-in-excel htt...

VB6 Automation Error on Calls to .NET 3.5 Assemblies After the First Calls

Some of the sources I've checked already: http://www.experts-exchange.com/Programming/Languages/.NET/Visual%5FBasic.NET/Q%5F23359339.html http://mygreenpaste.blogspot.com/2006/03/net-framework-20-configuration-tool.html http://support.microsoft.com/kb/186063 I'm busy developing .NET modules that will hook into our existing VB6 code. I'v...

C#.NET - Determine if PPT is in Slideshow

I am trying to create a PowerPoint add-in using C# and a 3rd-party SDK/API to enable wireless voting/message retrieval during a PowerPoint presentation. Is there any way that I can determine whether or not the user has hit 'F5' or selected 'Start Slideshow', because I obviously do not want the program executing while the user is editing...

COM object that has been separated from its underlying RCW can not be used - why does it happen?

Hi. I sometimes get the following exception: COM object that has been separated from its underlying RCW can not be used Sample code: using (AdOrganizationalUnit organizationalUnit = new AdOrganizationalUnit(ADHelper.GetDirectoryEntry(ouAdDn))) { using (AdUser user = organizationalUnit.AddUser(commonName)) { //set some properti...

Call an haskell function in .net

Hi, I want to use an Haskell function with the following type :: string -> string from a C# programm. I want to use hs-dotnet to bridge both worlds, the author claim that it's possible, but provide no sample of this case. The only samples provided are the one to use .net from haskell. Does anyone got a sample of this use, or got an ide...

.NET & Excel Interop: Copying User Selection to Clipboard

Fairly straightforward scenario, for which I can't seem to find an answer anywhere: I am using a Microsoft WebBrowser ActiveX control (AxSHDocVw.AxWebBrowser) in a Windows Forms application. The WebBrowser control is used to display Excel workbooks in the application. I can obtain a reference to the internal document as a Microsoft.O...

Writing .NET object in C?

Is there a way to write an object in C/C++ that can be used from .NET? I would like to do it in a most simple way, the one used to extend basically all other languages, i.e. write an object in C, conform to the interface required by the language runtime, use the object from the language. ...

C# Interop: Out params that can also be null

Consider the following DllImport: [DllImport("lulz.so")] public static extern int DoSomething(IntPtr SomeParam); This is actually referencing a C style function like this: int DoSomething(void* SomeParam); Consider that SomeParam is an "out" param, but can also be NULL. The C function behaves differently if the param is NULL. So ...

How to call windows form from native cpp

I have an existing project using c/c++ .NET. Currently I have been given a task to create a windows form from my existing code. So i have add new project windows form application in the existing c/c++ projects.form.h, form.cpp has been automatically created. Now I am having problem to call the window from my c files. Even i could not cal...

C#/C++ interop - Need help defining my data structure

Hi, I am working on a C# app that is trying to use functionality provided via a C++ DLL. I am having a bit of a hard time getting the DLLImport definitions to work right at the moment. Here's the C++ side of the equation: struct Result { FLOAT first; FLOAT second; }; struct ResultData { UINT uint1; UIN...

Managed to Native Interop on Windows Azure NO P/Invoke

Does Azure allow managed to native interop without the use of P/Invoke. I have a c header file and dll which I plan to wrap in a managed c++ dll, and then wrap that in a c# wrapper for ease of use. Anyways, the header file is to complicated to use with P/Invoke, and its much easier to use the managed c++ wrapper, however I don't know i...

Java <-> Scala interop: transparent List and Map conversion

I am learning Scala and I have a Java project to migrate to Scala. I want to migrate it by rewriting classes one-by-one and checking that new class didn't break the project. This Java project uses lots of java.util.List and java.util.Map. In new Scala classes I would like to use Scala’s List and Map to have good-looking Scala code. The...

MS Word Interop: Cancel (Don't Show) the 'Save Changes' Dialog on Close

Hi, I'm using MS Interop to open a generated file for a user, allow them to edit it and then close it, after which I save it for them (it's part of a larger process). Since the user doesn't need to save the file manually I would like to cancel that pop up dialog to save the file when the user tries to close the document. The following d...

What's going to happen if I use OLE Automation to load up a 32 bit control in a 64 bit app?

The .NET application for which I'm responsible uses a third-party control that is only available as a 32 bit COM component. I've been banging my head against walls for a while trying to find a way to allow the component and the app to work together in 64-bit mode. We got some help from the control vendor - they don't plan on supplying ...

Replace MergeFields in a Word 2003 document and keep style (c#)

Hi I've been trying to create a library to replace the MergeFields on a Word 2003 document, everything works fine, except that I lose the style applied to the field when I replace it, is there a way to keep it? This is the code I'm using to replace the fields: private void FillFields2003(string template, Dictionary<string, string> v...

How to make a transaction flow from Navision to a C# component registered for COM interop?

In my context I have Navision involved, but perhaps this is related to every COM interop scenario, I don't know. Anyway, the situation: - I've a simple C# component registered for COM Interop - I call it from Navision, just before inserting a new record (for who knows Navision, inside an 'OnInsert' trigger, thus in the context of a tran...