interop

Import WinAPI Function in *.VBS File

Hi there, Using visual basic in say Excel, I am able to declare WinAPI functions using the DECLARE keyword - e.g. Declare Function SetLocaleInfo Lib "kernel32" Alias "SetLocaleInfoA" ( _ ByVal Locale As Long, ByVal LCType As Long, ByVal lpLCData As String ) As Boolean However when using this syntax in a *.VBS file - it fa...

FDA and WCF Interoperablity Proof

How do I prove to the FDA that WCF is interoperable? Is there a document describing their test procedures? Or, is it common knowledge? ...

How to Access/marshall char *variable from dll import in C#

Hi I need to access functionality from win32 dll , for that I am using [dllimport] in C# code. what exact method signature i need to create with [dllimport] for the following c++ methods void GetGeneratedKey(char *code, int len, char *key) pls help in this. Thanks nRk ...

How to reliably find the foreground window when it does not have focus

So, I thought this would be simple and, well, I was wrong. Here is a simplified description of the problem: I am writing a small application for our manufacturing folks that will grab a screenshot of the entire desktop as well as the foreground window when they click the application's icon in the system tray. Currently, I am using the...

Passing multiple arguments from IronPython to .NET method.

Hi, I have a class in .NET (C#): public class MyHelper { public object exec( string script, params object[] arguments ) { // execute script with passed arguments in some external enviroment } } I'm using IronPython runtime in my code to run python scripts, which should in some cases call the "exec" method. I would lik...

Outlook 2007 from C# - COM exception, TYPE_E_LIBNOTREGISTERED

I'm trying to make a program that would open new Outlook 2007 message. I've referenced from COM tab Microsoft Outlook 12.0 ObjectLibrary. These items showed up in references in VS: Microsoft.Office.Core Microsoft.Office.Inerop.Outlook Now I try to invoke following code: var _outlookInstance = new Microsoft.Office.Interop.Outlook.Ap...

Adding html text to Word using Interop

I'm trying to add some HTML formatted text to Word using Office Interop. My code looks like this: Clipboard.SetText(notes, TextDataFormat.Html); pgCriteria.Range.Paste(); but it's throwing a Command Failed exception. Any idea? Thank you ...

Using Dynamics AX's Business Conectors to Generate Sales Orders

So, just like the title says, I need to create an application that gets data from another Database, and shoves it through Dynamics AX's throat. This data comes from a portal, not Enterprise Portal, but a PHP one. It stores some data from the order in a separate database. So as said, I need to 'import' that to AX, creating the sales ord...

ActiveX component installation is blocked by IE.

HI I have created a ActiveX componed and packed into a cab file 1) Created the setup for Class Library that I would like to be exposed for COM access. 2) Create the CAB setup project taking the Project output from the setup created in the setup 1. 3) Embedded the object tag in a sample html file Now when I launch the sample html...

Performance of Calling Unmanaged .dll from C#

How long is the typical overhead added by calling a .dll written in C++ from a C# application using the following syntax? [DllImport("abc.dll", EntryPoint = "xcFoo", CallingConvention = CallingConvention.Cdecl)] public extern static Result Foo(out IntPtr session, [MarshalAs(UnmanagedType.FunctionPtr)]ObjectCallback callb...

What Should I MarshalAs for Character Type in Fortran?

I am calling a fortran subroutine from C#. One of the parameter I have to pass in is character .i.e, in fortran that parameter is declared as character, intent(in) :: bmat*1 The issue now is, in C# code, what should I marshaled it as? I know that for integer, I should marshal it as [MarshalAs(UnmanagedType.I4)], but what about char...

Can safearrays take, and marshall, user defined types?

I would like to move fairly complex types from the managed to native world and visa versa. Currently this is being done by creating multidimensional safearrays, which has the advantage that marshalling is done for you, but means we end up with rather complex jagged arrays to get our heads around. I have tried to put some structs into S...

.NET Object from VB6 without use of regasm.exe?

Hello, The software company I'm working for builds software for schools, and so our client machines are usually locked down in such a way it makes it pretty impossible for us to install anything on it. Our old system is primarily based on a (very large) MS Access project and so it gets around the access problems by just running from a...

COM interop reference counting guidlines

Recently I spent quiet some time writing various Visual Studio Extensions projects. Even though the projects are all managed code to access the core VS services it is still necessary to work with the old style COM interfaces. Here is an example : var selectionTracker = (IVsMonitorSelection)serviceProvider.GetService(typeof(SVsShellM...

Worksheet.Unprotect - Office Interop - Difference between 2003 and 2007

I have a .NET winforms app that automates Excel and checks for a worksheet password. The requirements are to be able to detect 1) that the protection is turned off 2) that the password is removed (protected but there is no password) 3) that the password matches the correct password from a database To meet the second requirement the prog...

Calling C# From Unmanaged C++ Passing Or Returning "Complex" Types

Hello, I'm after help on how to use complex objects either as return values or passed as parameters to C# class methods exposed to unmanaged C++ as COM components Here's why: I'm working on a project where we have half a dozen unmanaged C++ applications that each directly access the same Microsoft SQL Server database. We want to be ab...

Working with a Java library from .NET

I need to work with a third-party Java library from .NET. Can anyone recommend a more elegant way to do this short of using a local socket connection to a Java wrapper. The information I've come across so far seems a little out-dated, and suggests things like using COM. The library is used to connect to a server. I think some RMI stuf...

Convert from double array to pointer

I have such class public unsafe class EigenSolver { public double* aPtr {get; private set;} public EigenSolver(double* ap) { aPtr = ap; } public EigenSolver(double[] aa) { // how to convert from aa double array to pointer? } public void Solve() { Interop.CallFortranCode(aPtr); } } As y...

COMException (0x80010108 - RPC_E_DISCONNECTED) When Closing Excel.Workbook

When I run the following code, I get the exception below: ''# NOTE: ExcelApp is a Private main form variable Dim ReportBooks As Excel.Workbooks = ExcelApp.Workbooks Dim ReportBook As Excel.Workbook = ReportBooks.Open(localFilename) Dim ReportSheet As Excel.Worksheet = ReportBook.Sheets("Report") ''# Retreive data from sheet ReleaseCOM...

.Net ActiveX component is not working from Remote Machines.

hi I have developed ActiveX componet i.e actually wrapper around a .Net Library. Every thing working fine if i launch the application from local ie where the application is hosted. The library actually prints a card. if i launch the application from a remote machine, The print dialog is coming but no printing is happening. Thanking...