interop

size of structures in .NET

My problem is very simple. My problem is to send a structure between a program in C to a C# program. I made a struct in C#: public struct NetPoint { public float lat; // 4 bytes public float lon; // 4 bytes public int alt; // 4 bytes public long time; // 8 bytes } Total size of the struct must be 20 bytes. When I do...

How to convert a scala.List to a java.util.List?

I'm trying to use some Scala code and am having a hard time figuring out how to convert the Scala lists into standard Java lists. Any ideas? ...

Any way to run DLL's at button click C#

Hi Guys, I'm looking for ways to speed my program to the max and one way I thought of was to strip all DLL's being run at startup and run them when they need to be. As an example, I have a DLL containing info required for an update module, but I don't want to have that running in the program if I don't need it till I have an update. (...

UnauthorizedAccessException in ComRegisterFunction when accessing registry on Win 7 64.

I have a [ComRegisterFunction] that I am using to register a BHO Internet explorer extension. During registration on 64-bit windows 7 machines, a UnauthorizedAccessException is thrown on the call to subKey.SetValue("NoExplorer", 1). The registry appears to have BHO's located @ \HKLM\SOFTWARE\Wow6432Node\Microsoft\Windows\CurrentVersio...

[WPF] Is D3DImage causing airspace problem?

A DirectX scene can be drawn inside of a WindowsFormsHost, but this solution concerns struggling with some interop issues, mainly the 'airspace' problem. Thus, before creating whole framework for this, I'd like to know, if a D3DImage used within a WPF window will cause alike problems with overlay and sizing as described in the WindowsFor...

Is it possible to do some interop with iWork?

I know it is possible with the .NET framework of Microsoft to do some interoperability with Microsoft Office. Is there something that exist that resembles to it for iWork and the Cocoa framework? Edit: Here are more details. I would like to create an application that has a GUI and that can generate Pages/Keynote/Numbers documents. ...

Is there any way, short of "copy and paste inheritence" to share a .net class with a Silverlight app?

I have a project in two parts: a Silverlight front end and a WCF duplex service. Ideally, I would like to pass a message of a custom type (call it TradeOffer) from the WCF service to be consumed by the Silverlight application. When I try to, I get an error that indicates I can't pass an object of an unknown type across the wire like tha...

Delphi, What do I do about "no GetEnumerator present" error when using a for loop over Excel Interop Worksheets collection?

Hello, I'm trying to write a Delphi program that will loop through each worksheet in an Excel file and format some cells. I'm receiving an error while trying to use the for-in loop over the Workbook.Worksheets collection, though. The error is specifically: [DCC Error] Office.pas(36): E2431 for-in statement cannot operate on coll...

How to get the current open documents in Excel using C#?

All I need is to get the list of currently open documents in the currently open instance of Microsoft Excel. But I don't know Excel terminology to know if these documents are called workbooks, or sheets, or windows, etc. Any ideas ...

Visual Studio 2010 64-bit COM Interop Issue

I am trying to add a VC6 COM DLL to our VS2010RC C# solution. The DLL was compiled with the VC6 tools to create an x86 version and was compiled with the VC7 Cross-platform tools to generate a VC7 DLL. The x86 version of the assembly works fine as long as the consuming C# project's platform is set to x86. It doesn't matter whether the x6...

c++ to vb.net , problems with callback function

I'm having a hard time here trying to find a solution for my problem. I'm trying to convert a client API funktion from C++ to VB.NET, and i think have some problems with the callback function. parts of the C++ code: typedef struct{ BYTE m_bRemoteChannel; BYTE m_bSendMode; BYTE m_nImgFormat; // =0 cif ; = 1 qcif char *m_s...

.NET Framework generates strange DCOM error

Hello, I am creating a simple application that enables merging of key-value pairs fields in a Word and/or Excel document. Until this day, the application has worked out just fine. I am using the latest version of .NET Framework 4.0 (since it provides a nice wrapper API for Interop). My sample merging method looks like this: public by...

Windows user control hosted in IE is not working.

Hi i have hosted a windows user control in IE. Every thing is working fine, if i open the application in the same machine where the Web application is hosted. if i access the same appication from a remote client IE, A blank box is coming with a small image in the corner. I have added the site as trusted site in the IE and made all ...

Strange behaviour using Drag and Drop in word 2003 automation in headers

Hi! I am developing a template based addin for Word 2003 which allows the user to drag and drop elements from a listbox into the word document. Unfortunately I'm getting a really strange behaviour when trying to drop elements in the document's header. Open the template and type something in the header Close the header and insert some ...

How to take a collection of bytes and pull typed values out of it?

Say I have a collection of bytes var bytes = new byte[] {0, 1, 2, 3, 4, 5, 6, 7}; and I want to pull out a defined value from the bytes as a managed type, e.g. a ushort. What is a simple way to define what types reside at what location in the collection and pull out those values? One (ugly) way is to use System.BitConverter and a Que...

Marshalling a big-endian byte collection into a struct in order to pull out values

There is an insightful question about reading a C/C++ data structure in C# from a byte array, but I cannot get the code to work for my collection of big-endian (network byte order) bytes. (EDIT: Note that my real struct has more than just one field.) Is there a way to marshal the bytes into a big-endian version of the structure and then ...

C#. How to pass message from unsafe callback to managed code?

Is there a simple example of how to pass messages from unsafe callback to managed code? I have a proprietary dll which receives some messages packed in structs and all is coming to a callback function. The example of usage is as follows but it calls unsafe code too. I want to pass the messages into my application which is all managed c...

Creating a C# DLL and using it from unmanaged C++

I have a native (unmanaged) C++ application (using wxWidgets for what it's worth). I'm considering a separate tool application to be written in C# which would contain winform-based dialogs. putting some of those dialogs in a separate DLL would be useful as I'd hope to be able to use them from my C++ app. But I have no idea how much mess...

I can't get SetSystemTime to work in Windows Vista using C# with Interop (P/Invoke).

Hi, I'm having a hard time getting SetSystemTime working in my C# code. SetSystemtime is a kernel32.dll function. I'm using P/invoke (interop) to call it. SetSystemtime returns false and the error is "Invalid Parameter". I've posted the code below. I stress that GetSystemTime works just fine. I've tested this on Vista and Windows 7. ...

Blittable Vs. Non-Blittable in IL

I'm trying to make sure that my Managed to Unmanaged calls are optimized. Is there a quick way to see by looking at the IL if any non-blittable types have accidentally gotten into my pinvoke calls? I tried just writing two unmanaged functions in a .dll, one that uses bool (which is non-blittable) and one that uses ints. But I didn't s...