interop

VB6 Variant Type to .NET Type

I have some VB6 code that can't be modified easily that looks like this: Dim cCount as Long Dim rCount as Long Dim result() Set mx = CreateObject("Component.Class") Dim rtn = mx.GetList(rCount,cCount,result) The method it calls is currently a VB6 component that we've migrated to .NET with one issue. We're not sure what type the resul...

What's the best way to export DataTable to an Excel file?

As far as I know, there're 3 ways to do this: The first way is using COM Interop to create a Excel file, then iterate over all cells to read and write data. The created file appears to be valid (true .XLS file), but it seems that Excel must installed to use this way The second way is writing a file header (CSS style), and then iterate ...

C/C++ within Ruby code?

C/C++ would be good option to write some of the performance critical aspects of a Ruby Application. I know this is possible. I would like to know how to add C/C++ code into Ruby code; any other language for that matter. Are there any practical applications of this which you noticed in open source projects or else? ...

Implementing C# EventHandlers in F#

I have an interface, written in C#, defined as this : public interface IWidget { object Evaluate(); event EventHandler Invalidated; } When I try to implement this interface in F#, I look at what F# thinks the IWidget interface is (by hovering my mouse over it), and I see type IWidget = interface member Evaluate :...

Read Excel from Silverlight and Process it in WCF Service in C#

Hello, I want to read the contents of Excel file from local disk using Silverlight and want to pass the data to WCF service. The service will then select the data from the worksheet and put it into database. I want to know which data type shall i use to pass the Excel object to WCF Service? Thanks in advance. ...

System.Type.Missing or System.Reflection.Missing.Value when working with Office PIA?

I searched these SO results and couldn't find anything related to my question. I doubt this could be a duplicate. I'm currently writing a Microsoft.Office.Interop.Excel PIA wrapper in .NET C# 3.5 and was wondering about what is best to use while calling methods like opening a given workbook. System.Type.Missing or Missing.Value? I hav...

How to convert a void* to a type that can be used in C#? Interoperability between C DLL and C#

Hi, I am a C/C++ programmer, but I was asked to update a program that was written in C# to communicate with a device. My knowledge of C# is very basic. The previous version was totally written in C#, but now the API that in fact access the device was changed to C. I found out that I can import the C function APIs by using: [DllImport(...

Running executable from memory

I'm trying to run an executable directly from a byte[] representation of this executable as a resource in C#. So basically i want to run a byte[] of an PE directly without touching the harddisk. The code I'm using for this used to work but it doesn't anymore. The code creates a process with a frozen main thread, changes the whole proc...

Why does attr_accessor create a property, but method is just a method?

I am playing around with the interop between C# and IronRuby. I have noticed that if I define a property in Ruby using attr_accessor, it is presented to C# as a property. If, on the other hand, I create the exact same code manually, it comes back as a method. For example, take this code: var engine = IronRuby.Ruby.CreateEngine(); str...

How do you call a Scala singleton method from Java?

I'm trying to inject some Scala code into my existing Java app. (So, being said, I want some more fun). I create a singleton stuff in Scala ScalaPower.scala package org.fun class ScalaPower object ScalaPower{ def showMyPower(time:Int) = { (0 to time-1).mkString(", ") } } Now, inside OldJava.java ...

C# project 2010, standalone executable on other computer

Hi All, I have a C# project that I have created in Visual Studio Express 2010. This program uses a 3rd party C# class that relies on/calls a C++ dll. I just copied the filename.dll into the bin/debug and bin/release folders of the project folder, and the application ran fine. I am under the assumption that I can copy the release execut...

Can I incorporate GPL-licensed code into an out-proc COM server and use that server from my proprietary program?

After reading this paragraph in GPL FAQ I feel confused. That paragraph says that a proprietary program can use a GPL-licensed program via aggregation - as a separate program. Now consider an out-proc COM server. It is a separate program that is used by another program via a well-known interface. Looks pretty much like aggregation. Can...

Read page headers and footer from Word.Range - VSTO Word Interop C#

I have a Range object and I want to use it to extract information from the page where the Range reside in. The information is in the headers and the footers inside a table, I want to read the text from the table. I tried: word.Sections[1].Headers[WdHeaderFooterIndex.wdHeaderFooterPrimary].Shapes.Range(ref pageNumber).TextFrame.TextRange...

What is Scala trying to tell me and how do I fix this? [ required: java.util.List[?0] where type ?0]

I am in the process of learning Scala and today I felt confident to introduce it to one of our projects. The application does a lot of JPA / Hibernate stuff and I started implementing one of the Java interfaces in Scala. All went well, until I tried to translate some unittest-code to Scala. I make a lot of use of Easymock, the code is ...

Using a C/C++ data structure in a C# program

I have a super high-performance C/C++ data structure (see here!) that I'd like to access and use in my C# program. Imagine the C/C++ data structure has a public API (get, add, delete, etc). How can I call these methods lots of times within C# in a high-performance way? P.S. Before you criticize my use of the phrase "C/C++"... In my vie...

Microsoft.Office.Interop.PowerPoint.dll PowerPoint CustomDocumentProperties big problem

Hi ! I have application which can export slides to PowerPoint. I'm using Microsoft.Office.Interop.PowerPoint.dll . This is the 11th version of assembly. I have ran application today and it seems that application throws an exception (Exception from HRESULT: 0x80070057 (E_INVALIDARG)). It only throws this exception when there is powerpoin...

How do you run another .exe from VB.NET as another User?

How do you run another .exe from VB.NET but as another User? I expect to launch a .exe like "Left Click -> Run As -> Enter User/Pass -> Click OK" If I do that, my application runs as expected (I need to run it as another user to get access to some folders in the network) But if I use this in VB.NET System.Diagnostics.Process.Start(Syst...

What approach can I take to calling into a non c-style native c++ interface which from just the dll from .NET ?

I've been browsing the web for over 48 hours reading up on interoperability and playing around with Pinvoke and C++/Cli (very limited the latter). There is an unmanaged c++ api (a namespace containing a lot of exported structs which contain methods, all pure virtual and implemented across several cpp files as classes and what not) and I ...

Use C++ constants in C# program

Hello All, We have a situation where we use a set of third-party unmanaged C++ libraries in our C# (WPF) application, but we also use a subset of their include libraries to build our own unmanaged libraries to use in our application. These libraries produce metadata, which is stored in a database. However, we must replicate some const...

GWT interoperability: invoke java applet from GWT generated javascript

Hi, Since GWT is cross-compiled to javascript, only a few JRE packages are emulated. What if I need to make complex computations with packages not supported by the GWT x-compiling? Is there a way to create a separate java app that can be invoked from the client side GWT (which would of course need to be shipped with the client). I don'...