interop

How I can declare arrays in struct?

早过忘川 提交于 2019-12-04 05:08:43
How can I declare structure with a fixed size array in it? I found solution, but it only works for primitive data-types. I need my array to be of type MyStruct . So how can I declare a struct with an array of other structs in it? ex. unsafe struct Struct1{ fixed int arrayInt[100]; // works properly fixed Struct2 arrayStruct[100]; //not compile } My colleague found the working way to do this. I think it`s right way. [StructLayout(LayoutKind.Sequential)] public struct Struct1 { [MarshalAs(UnmanagedType.ByValArray, SizeConst = sizeOfarray)] private Struct2[] arrayStruct; } You can't. Fixed arrays

Usefulness of JNI [closed]

吃可爱长大的小学妹 提交于 2019-12-04 05:03:42
I've been a java developer for a couple years and have heard that you can do some pretty useful and powerful things with JNI. I don't know if I just haven't needed to use it or if it isn't terribly relevant to me; but I have not had to touch it at all. I am wondering what the usefulness of this aspect of Java is. Examples would be great. It is very useful. I can see 2 primary reasons to use JNI (there are likely more). Performance. If you have a piece of code in which the Java Runtime for whatever reason can't cut it performance wise. You can implement that function in native code and call it

Export from DataGrid to Excel with Interop is too slow

萝らか妹 提交于 2019-12-04 04:56:09
问题 I'm about to write a WPF application that takes data from database and displays it in DataGrid. Then with a button an Excel file is created and filled with the data. With large quantities like 20000 lines the filling in Excel takes too long. Does someone have an idea why? Thank you private void copyAlltoClipboard() { Clipboard.Clear(); DataGrid1.SelectAllCells(); DataGrid1.ClipboardCopyMode = DataGridClipboardCopyMode.IncludeHeader; ApplicationCommands.Copy.Execute(null, DataGrid1); } private

Determine if an open WPF window is visible on any monitor

一世执手 提交于 2019-12-04 04:47:10
Is there a way to determine if an open WPF window is currently visible in any of the desktop's connected monitors? By visible I mean that the window's bounds rectangle intersects with the desktop rectangle of any of the monitors. I need this functionality to determine if a window needs to be repositioned because the monitor configuration (working areas bounds, monitor count) changed between restarts of my application (which saves window positions). I have come up with the code below and it seems to work, but it has several problems: I need to reference windows forms. I need the desktop's DPI

32 and 64 bit interoperability on 64-bit Windows

百般思念 提交于 2019-12-04 04:41:07
Is there a good thorough authoritative reference that discusses interoperability between 32-bit and 64-bit processes? Based on googling I have deduced that: A 32-bit DLL can only reside in a 32-bit process, and a 64-bit DLL only in a 64-bit process. 32 and 64-bit processes can only communicate using loosely coupled message systems, such as network communications, which means they can communicate using COM/DCOM. 32 and 64-bit COM components have different registry entries. A component is typically only registered in one of the two and typically only seen in one of the two worlds. A 32-bit

how to tell elm about external DOM changes

本秂侑毒 提交于 2019-12-04 04:00:47
问题 I'm using elm 0.17.1 and trying to interop with select2 javascript library(version 4.0.3), here is my Main.elm : port module Main exposing (..) import Html exposing (Html,select,option,div,text,br) import Html.App as App import Html.Attributes exposing (id,value,width) -- MODEL type alias Model = { country : String } -- UPDATE type Msg = Select String update : Msg -> Model -> (Model, Cmd Msg) update msg model = case msg of Select str -> (Model str,Cmd.none) -- VIEW view : Model -> Html Msg

BadImageFormatException encountered with WcfSvcHost and IIS WCF host

半世苍凉 提交于 2019-12-04 04:00:38
问题 Creating a WCF Service Library in Visual Studio 2008 on Vista x64 is troublesome when referencing an x86 DLL. A service that calls a 32-bit DLL is required to have a platform target of x86 to run on a 64-bit OS. When you do this, the WcfSvcHost throws a BadImageFormatException when you attempt to debug the service. There is a bug report on MS connect. The workaround I used was to coreflag WcfSvcHost as 32-bit. Manifest Problem The main issue I've run in to is this third-party native 32-bit

This command requires at least two rows of source data

◇◆丶佛笑我妖孽 提交于 2019-12-04 03:59:02
问题 I am getting this error: This command requires at least two rows of source data. You cannot use the command on a selection in only one row. Try the following: - If you're using an advanced filter, select a range of cells that contains at least two rows of data. Then click the Advanced Filter command again. - I you're creating a PivotTable, type a cell reference or select a range that includes at least two rows of data intermittently on this line of code: xlWorkBook.RefreshAll(); There are two

Can I call clojure code from C++?

北城以北 提交于 2019-12-04 03:58:29
问题 I'm writing a plugin for a program written in C++. Plugins are placed in a specific dir and get called by the main application. I would like to write most of the plugin in Clojure (gui, calculations, etc) however the actual "plugin" needs to be written in C++. Various data needs to be passed from C++ to Clojure. How can I do this? JNI/JNA, sockets, system calls? (nothing I know much about) 回答1: I know this question is old but maybe somebody find this useful. #include <jni.h> /* where

How to generate AxInterop files?

你。 提交于 2019-12-04 03:50:29
We have a .NET project that relies on an old VB6 OCX (The entire thing was originally VB6 and C++ and we are gradually migrating it all to .Net but we need it working in its present half-migrated state). One of our developers can build the project but no-one else can. The developer finds that he has references to an interop.foo.dll file and an AxInterop.foo.dll, both of which exist. I have built the VB6 project and added a reference to the OCX into my copy of the .NET project by browsing to it. I now have a reference to the interop.foo.dll, which exists, but I do not have a reference to the