interop

How do I use unsafe values in an enum?

I need to use this enum in my C# application, but it won't let me use these values. When I specify the type as uint I can use the -1 value, and when I specify int I can't use the last 2 values. Is there a way to use the unchecked keyword here to allow me to define all of these values? These values are coming from an external source, so I...

Exposing .NET enums to COM clients{VBScript}

Am trying create of PoC for exposing/invoking various .NET objects from COM clients. The .NET library contains some classes and Enums. Am able to successfully access the classes in VBScript but not able to access the Enums. I know that Enums are value types and hence 'CreateObject' wont work in this case. But am able to access the sam...

Using C# assemblies from VB6 code. Some issues.

I have a C# assembly, which is regasmed, but is not in the GAC. In my VB6 code, I added a reference to the generated type library (the .tlb file). Then I instantiate the C# lib in my VB6 code. If I run it from the VB6 IDE, it does not work. The Set in the code below: Dim obj as MyCSharpNamespace.MyCSharpObject Set obj = New MyC...

Invoking powershell from Java

Anyone know of a good library to invoke powershell scripts from within Java? I'm currently spawning a seperate process (powershell.exe) and then parse the output, but it would really be nice if I can leverage Powershell's 'power' by getting objects back from a powershell call. Edit: Otherwise, anyone else doing such interop? What metho...

IIS, Impersonation and COM Interop Premission Denied

Hello we are in the throws of integrating a Document Management System with Dynamic CRM 4, have done similar things previously but in this instance we are having to reference a COM dll. We've configured the asp.net page (we are bringing the info in via a i-Frame in CRM), setting Impersonation = True in the Webconfig and ensured that Win...

The .NET ActiveX component with WPF content can't be loaded by non MFC app

I have a legacy delphi program and want to add some content implemented with WPF. So I encapsulate the WPF control with a .NET/ActiveX interop technology. That means something like: [ComRegisterFunction()] public static void RegisterClass(string key); [ComUnregisterFunction()] public static void UnregisterClass(string key); The active...

How can i get the between cell addresses.

I have a function which accepts fromRange and ToRange of an Excel cell. basically i want to read cell by cell values from the range. suppose if i pass E2 and E9 i want to read in a loop something like Range(E2).value, Range(E3).value and so on till E9 How can i get the between cell addresses. Please help ...

Using ref Array parameters in C# with COM interop

I have a 3rd party COM libary that I'm consuming and am having problems with array parameters. The method signature that I'm calling is as follows: int GetItems(ref System.Array theArray) The documentation says that the method's return value is the number of items it will populate into the array, but when it get's called, all of the ...

ExecutionEngineException thrown when loading native dll

I have a 32-bit .net application that uses a native 32-bit DLL via DllImport(). The native DLL is our internal file analysis library, and I need to use it as porting it to C# would be a problem if people update it (other software uses it). The problem is that when I try to execute any method in the native DLL I get a System.ExecutionEng...

Embed bash in python

Hi, I am writting a python script and I am running out of time. I need to so some things that I know pretty well in bash, so I just wonder how can I embed some bash lines into a python script. Thanks ...

Consuming Java web-services using .NET Client

Im trying to consume a Java web-service, that uses a certificate. I could generate the proxy, adding Service Reference. The problem is: It needs Basic HTTP Authorization Header. Its necessary to encript the user/password and pass them in the header. Thanks. ...

What's the best way to mix Ruby and other languages? (Especially C++)

Hi, I'm learning Ruby, and I'm starting to play with building extensions in C. I have Programming Ruby The Pragmatic Programmers' Guide and so I can follow that for the basic nuts and bolts. What I was wondering is if there already existed some nifty frameworks/whatever to help interoperability between Ruby and other languages, with C++...

Visual Studio 2010, TlbImp generates .net 4.0 interops in 2.0 projects

In a C# project we add a reference to a COM object via the Add References setup pointing to a COM object which results in the IDE auto-generating the interop assembly. So this is fine and good, but we are building based on .net 3.5 SP1 aka CLR 2.0, and the generated interops are using the 4.0 CLR making them incompatible. Is there a way ...

How do I find out what the windows constants like WM_MOUSEMOVE and WM_MOUSEDOWN are if I'm using C#?

I'm writing some code that uses some unmanaged calls into user32 functions such as SetWindowsHookEx, etc. This requires me to use lots of constants that I'm not sure what their value is. For example, if I want to set the hook as a low-level mouse hook I need to know that WM_MOUSE_LL = 14. Where can I look these up? I need to know wha...

Using Microsoft.Office.Interop to save created file with C#

I have the this code that will create excel file and work sheet then insert same values. The problem I'm facing that I'm not able to save the file with name giving ten colse it. I used SaveAs but did not work: wb.SaveAs(@"C:\mymytest.xlsx", missing, missing, missing, missing, missing, XlSaveAsAccessMode.xlExclusive, missing, mis...

Interop: HmacSHA1 in Java and dotNet

Hello, In an app we are calculating a SHA1Hmac in java using the following: SecretKey key = new SecretKeySpec(secret, "HmacSHA1"); Mac m = Mac.getInstance("HmacSHA1"); m.init(key); byte[] hmac = m.doFinal(data); And later, the hmac is verified in C# - on a SmartCard - using: HMACSHA1 hmacSha = new HMACSHA1(secret); hmacSha.Initi...

Parsing a .NET DataSet returned from a .NET Web Service in Java

I have to consume a .NET hosted web service from a Java application. Interoperability between the two is usually very good. The problem I'm running into is that the .NET application developer chose to expose data using the .NET DataSet object. There are lots of articles written as to why you should not do this and how it makes interopera...

Office Word 2007 Interop - Header FieldCodes not showing up in my code, but are when viewed with Word

Hello, I'm writing an application in Delphi (have two over revisions of it written in both C# and Visual Basic, also). In my C# and Visual Basic version, I did something like the following to loop through the header/footer FieldCodes: // Supress filename, date and username field codes in headers fieldCount = WordApp.ActiveDocum...

AccessViolationException outside Visual Studio?

Hello, I'm developing a small C# winforms application that consumes an unmanaged C++ library. I have no access to the code of this library. If I'm in Visual Studio and I runt my application, do my calls to the library everything is working find. Once I run CTRL + F5 I get an AccessViolationException. I did some testing, created anoth...

Java and .net interoperability

I have a c# program through which i am opening cmd window as a a process. in this command window i am running a batch file. i am redirecting the output of that batch file commands to a Text File. When i run my application everything seems to be ok. But few times, Application is giving some error like "Can't access the file. it's being u...