interop

pinvoke marshalling of 2d multidimensional array of type double as input and output between c# and c++

放肆的年华 提交于 2019-12-08 03:56:50
问题 I have the following c# and c++ pinvoke marshalling of 2d multidimensional array of type double matter I'm trying to solve. I've reviewed the following hit to get what I have currently P/Invoke with arrays of double - marshalling data between C# and C++ . I've reviewed Marshalling C# Jagged Array to C++ which has a very good scenario match but it's not clear how to go from answer to all aspects of implementation. My issue, I think if i'm on right path so far, is how I unwind the c++

Mail Merge (Excel to Word) using C#

自闭症网瘾萝莉.ら 提交于 2019-12-08 03:46:27
I was wondering if anybody knew how to do a mail merge using an Excel file as a datasource, to fill in fields on a Word template? I wish to use the interop for Word if i could...but am having a few difficulties finding code for this. Does anybody have any syntax for this? Thank you in advance. A very useful method for learning how to automate specific actions in MS Word is to actually perform the action manually with 'Record Macro' enabled. Once you have the VBA macro its easy enough to convert this to VB.NET or C# that uses interop. I tend to tweak the VBA first manually in Word so I can then

Marshalling C# structure to C++ Using StructureToPtr

假装没事ソ 提交于 2019-12-08 02:48:48
问题 I have C# class: namespace Models { [StructLayout(LayoutKind.Explicit, Size = 120, CharSet = CharSet.Unicode)] public struct DynamicState { [FieldOffset(0)] public double[] Position; [FieldOffset(24)] public double[] Velocity; [FieldOffset(48)] public double[] Acceleration; [FieldOffset(72)] public double[] Attitude; [FieldOffset(96)] public double[] AngularVelocity; } } and C++/CLI method: Models::DynamicState SomeClassClr::DoSomething(Models::DynamicState ds) { int struct_size = Marshal:

How to Pass an Array from C# (VSTO) project to VBA Macro

我与影子孤独终老i 提交于 2019-12-08 02:41:43
问题 I'm having performance issues with my VSTO solution, I believe the reason is mainly the way the cellColor is set cell by cell. This depends on data from a recordSet and is thus different everytime. (I can't use a copyFormats from another row/column) it's similar to filling a Range of values, only for that one there are several methods. I thought about creating the whole thing in C# in Memory first (a XlColorIndex[,] array) which I pass through to a VBA method similar to the one below: Sub

C# 4.0 dynamic object and WinAPI interfaces like IShellItem (without defining them in the C# source)

强颜欢笑 提交于 2019-12-08 02:01:25
问题 Is it possible (with the new dynamic keyword in C# 4.0) to use interfaces (like IShellItem or other WinAPI interfaces) without defining them in my C# source code? Or at least not define the interface members? I'm trying something like: const string IShellItemGuid = "43826D1E-E718-42EE-BC55-A1E261C37BFE"; Guid guid = new Guid(IShellItemGuid); dynamic nativeShellItem = null; // Create and initializes a Shell item object (IShellItem) from a parsing name SHCreateItemFromParsingName(@"M:\TEST.TXT"

Writing C++ intended to be called from C#?

痴心易碎 提交于 2019-12-08 01:57:11
问题 So I am doing this as a learning moment and I'm not afraid to say I have no idea what I'm doing here. It might also be worth mentioning that I don't know much about C++ in this scenario. In C#, I've used DllImport plenty of times to bring in stuff from user32.dll or other DLLs that I haven't written, but I'm looking to better understand how the other half (the C++ half) is implemented to make this happen. The C++ code I have is simple and just to verify that the call went through successfully

communication between Java and C#

你离开我真会死。 提交于 2019-12-08 01:01:29
问题 I found out that there is a .Net toolkit called GCT - Group Communication Toolkit that is the C# version of JGroup. I want to know whether this and JGroup can be connected together to make java and C# clients communicate with each other. If not, what would be the best option to make a java program and a C# program communicate? One other option I came across is XMPP implementation. I require very fast message passing between those two programs that are running in the same computer. The main

how to use a complex return object from clojurescript in javascript

喜夏-厌秋 提交于 2019-12-08 00:37:17
问题 I want to write a clojurescript function that returns a complex item like ["foo" "bar"] or (list "foo" "bar") and I want to be able to call this function from javascript and get at the parts of the return value. How can it be done? In my case, the number of items in the vector/list/collection that I'm returning is known beforehand, and the collection should remain ordered. Here's my clojurescript function. I could do something differently here if it made things easier. Just don't know what

How can I turn ON radio of a Wifi adapter that is actually OFF?

北城余情 提交于 2019-12-07 23:54:31
问题 I'm using Managed Wifi to get the radio state of my Wifi adapter. How can I turn the radio ON in case it is actually off ? Something like this : WlanClient wlanClient = new WlanClient() var targetInterface = wlanClient.Interfaces.FirstOrDefault() if (targetInterface != null) { bool radioIsOff = targetInterface .RadioState.PhyRadioState[0].dot11SoftwareRadioState == Wlan.Dot11RadioState.Off; if (radioIsOff) { // TODO } } 回答1: I just added this to the WlanInterface class of the Managed Wifi API

Need to Find the COM DLL from an interop dll

左心房为你撑大大i 提交于 2019-12-07 23:25:53
问题 I have a Interop dll in a c# project, But I am not able to findout the corresponding COM dll associated with it. Please let me know, how to find out the actual COM dll from its interop dll. 回答1: Got it. One way is to use any one of its class in the project. Then go to definition of it, which will take us to Metadata. we can note down the GUID and then search it in registry, if that is available, like this one. namespace NETWORKLIST { [ClassInterface(0)] [Guid("DCB00C01-570F-4A9B-8D69