interop

C# Interop to WaveOut Functions on X64

We have some services that need to use sound output functionality. SoundPlayer won't play sounds while the application is running as a service on Windows 7. It will on Server 2003. Don't ask me why. This may have been deliberate on somebody's part at Microsoft, but ... So, we thought we'd use interop to the waveOut functions. That ...

Finding external calls in a C++ dll

We currently use a hardware driver's DLL for a particular piece of hardware we interface with. However, we also have an old internally developed DLL written with VC++ around 2002 that wraps that DLL for a few core functions. This code has been long lost, and was developed well before I came on the scene. So, it cannot be supported or eve...

Integrating plug-ins of different languages in a framework

I am novel software guy so I have little experience with software design. I have a question to ask: suppose I create a extensible software application with a plug in architecture, so that new applications can be integrated in this tool. If a new application is written in a different language and needs to be integrated in this application...

Is Intptr sufficient when marshalling for wrapping a c++ interface (all abstract) which works by passing interface handles?

I am trying to wrap an unmanaged c++ interface composed of several abstract structs (with all pure virtual methods) and a small factory namespace which returns handles (shared_ptrs) to these structs. It seems that, because of this, I might be able to get away with merely marshalling pointers through as System.IntPtr types (although them...

How to deploy COM object Microsoft.Office.Interop to IIS so that my C# WCF service reference will work?

I am getting an error when trying to run my web application from IIS 7 on my local machine regarding Microsoft.Office.Interop.Outlook that is like the following... Retrieving the COM class factory for component with CLSID {0006F03A-0000-0000-C000-000000000046} failed due to the following error: 80070005 Access is denied. (Exception fro...

Calling managed code from unmanaged code in VS2010

Hi, I have an managed c# application that uses expression encoder 4 SDK, and thus requires .NET 4 and hence VS2010. I wish to startup and stop this application as an in process DLL. This article and demo on code project proved a very useful proof of principle http://www.codeproject.com/KB/mcpp/ijw_unmanaged.aspx The included demo wo...

Manipulating Excel Data using Visual C#

Hi, I need to set/insert hyperlinks for a range of values in an Excel sheet from my program written in Visual C#. I am using "Microsoft.Office.Interop.Excel" and no third party Excel tools. I have URLs in string format with me in the program which need to show up as Hyperlinks in the Excel workbook. Any ideas on how this can be imple...

Accessing linux file system in a C# program.

Hi all, I am programming a C# application that checks the last time a file was modified on 3 different servers, one of these being linux. Being a different file system what are the possible ways to check when said file was last modified on the system. I have full access to modifying the server to an extent but I am looking for a number...

disabling overwrite existing file prompt in Microsoft office interop FileSaveAs method

Hi, I am using Ms Office Interop assemblies to create a MS Project file. To save the file created, I am using FileSaveAs method and it prompts a message saying that if you want to replace the existing file. I want to suppress the message, and I didn't find any parameter in FileSaveAs method for this purpose. Any Idea on this? I'am using ...

How to transform one C# structure to another like in C++?

Assume that we have two C# structures: [Serializable, StructLayout(LayoutKind.Sequential, Pack = 1)] public struct ByteStructure { public byte byte0; public byte byte1; public byte byte2; public byte byte3; public byte byte4; public byte byte5; public byte byte6; ...

How do i close all open windows from my C# program?

Hi i have a windows application where i show a webbrowser, i have a button that removes the browser (its a preview) and goes to another "view" in my application (another tab). My problem is that my users are getting advanced, they build HTML with links (and its ok) but the links may spawn new browser windows (IExplorer), and my button ne...

Passing an object from C++ to C# though COM

Hi, hi have a COM visible API in C# which looks like the following: public void DoSomething(string par1, string par2, object additionalParameter) The idea is that based on the value of the string parameters I expect a different class as the third parameter and cast it appropriately in the implementation (I know this design is not opt...

Implement callback C# functions for C++ DLL

I'm writing a DLL wrapper for my C++ library, to be called from C#. This wrapper should also have callback functions called from lib and implemented in C#. These functions have for instance std::vector as output parameters. I don't know how to make this. How to pass a buffer of unknown size from C# to C++ via a callback function? Let's t...

Trying to perform a Diffie Hellman Key exchange, using Win32 CAPI, in C#; can anyone provide a step-by-step guide

Hi, I'm trying to build some code that will switch between the old CAPI or the new CNG-based Diffie-Hellman algorithms. (Despite documentation, the new ECC-based DH algorithm, as part of CNG, is not supported on Windows XP). Anyway, I've begun exposing the Win32 CAPI, as follows: public static class CAPI { private static int ALG_...

Expose Unmanaged Code's Constant to Manage Dll

I have a C++ dll which has a GPC_EPSILON constant defined as such #define GPC_EPSILON (DBL_EPSILON) Is there anyway to expose this GPC_EPSILON to managed dll via interop, so that I can set this value from .Net dll? ...

Unable to find an entry point named * in dll

I have a C++ project with the following definition in the header file: typedef enum /* Set operation type */ { GPC_DIFF, /* Difference */ GPC_INT, /* Intersection */ GPC_XOR, /...

Interop between F# and C# lambdas

F# powerpack comes with a set of conversion methods to translate from Func<...> to F# functions, either standard or tupled ones. But is it possible to achieve the opposite: in case you want to call from F# code a C# method that takes Func<...> and want to use native F# lambda expression (e.g. fun x -> some_function_of(x))? If I send a F...

GAC – Assembly is in the GAC but “Could not load file or assembly”

Hi, I have an Interop dll that was generated by Visual Studio for a third-party COM object that I am consuming in a .NET dll. I have registered both my consuming dll and the Interop dll in the GAC. I have to use the GAC because these DLLs are being used by a SharePoint 2010 workflow. When the execution gets to the point where my dll ...

Control.FromHandle for WPF

Is there something like: Control.FromHandle(IntPtr) For WPF. This method is available for WinForms, so I'm just wondering if WPF has it too. Thanks! ...

Access to excel file in the server without installing excel

Hello, I've created a library to pass/get data to/from excel. To execute in my machine i modified the access permisions in COM+ console. The thing is that im interested in upload this component to my online server, but there i havent installed excel. Are there any way to register excel in COM+ without install excel? Thanks in adva...