interop

Clojure Jython interop

﹥>﹥吖頭↗ 提交于 2019-12-29 03:30:07
问题 I was wondering if anyone has tried somehow calling Jython functions from within Clojure, and how you went about doing this if so. I have not used Jython, but I would imagine the Jython interpreter can be invoked in the same way as any other java code, and Python programs can be run within it. However I wonder if it would be possible to somehow call individual python functions from Clojure. Like I said, I have not tried this yet, so it might actually be straightforward and obvious. I'm just

Marshal an array of strings from C# to C code using p/invoke

左心房为你撑大大i 提交于 2019-12-29 01:23:57
问题 I need to pass an array of C# strings into C code Example C code void print_string_array(const char** str_array, int length){ for (int i = 0; i < length; ++i) { printf("Sting[%l] = %s\n", i, str_array[i]); } } C# that I have tried (This did not work) string foo[] = {"testing", "one", "two", "three"}; print_string_array(foo, foo.Length); [DllImport(my_C_dll, CharSet = CharSet.Ansi)] private static extern void print_string_array([In][MarshalAs(UnmanagedType.LPArray, ArraySubType=UnmanagedType

Set custom document properties with Word interop

我只是一个虾纸丫 提交于 2019-12-28 18:05:25
问题 I want to set some custom document properties of a word document I'm creating in my C# code. To do this, I followed this MSDN article and came up with this code: using Word = Microsoft.Office.Interop.Word; // Version 12.0.0.0 word = new Word.Application(); word.Visible = false; Word._Document doc = word.Documents.Add(ref missing, ref missing, ref missing, ref missing); logger.Info("Setting document properties"); Core.DocumentProperties properties = (Core.DocumentProperties)doc

Initializing an array on arbitrary starting index in c#

早过忘川 提交于 2019-12-28 04:21:09
问题 Is it possible in c# to initialize an array in, for example, subindex 1? I'm working with Office interop, and every property is an object array that starts in 1 (I assume it was originally programed in VB.NET), and you cannot modify it, you have to set the entire array for it to accept the changes. As a workaround I am cloning the original array, modifying that one, and setting it as a whole when I'm done. But, I was wondering if it was possible to create a new non-zero based array 回答1: You

How to read an Excel spreadsheet in c# quickly

天大地大妈咪最大 提交于 2019-12-28 03:52:05
问题 I am using Microsoft.Office.Interop.Excel to read a spreadsheet that is open in memory. gXlWs = (Microsoft.Office.Interop.Excel.Worksheet)gXlApp.ActiveWorkbook.ActiveSheet; int NumCols = 7; string[] Fields = new string[NumCols]; string input = null; int NumRow = 2; while (Convert.ToString(((Microsoft.Office.Interop.Excel.Range)gXlWs.Cells[NumRow, 1]).Value2) != null) { for (int c = 1; c <= NumCols; c++) { Fields[c-1] = Convert.ToString(((Microsoft.Office.Interop.Excel.Range)gXlWs.Cells[NumRow

Send message to a Windows process (not its main window)

守給你的承諾、 提交于 2019-12-28 03:39:31
问题 I have an application that on a subsequent start detects if there's a process with the same name already running and, if so, activates the running app's window and then exits. The problem is that the main window could be hidden (only a notification area icon visible), thus leaving me with no window handle. At startup, previous instance's MainWindowHandle property is 0, so I can't send ShowWindow or PostMessage . Is there any way I can send a message that can be intercepted by the running app,

Send message to a Windows process (not its main window)

那年仲夏 提交于 2019-12-28 03:39:16
问题 I have an application that on a subsequent start detects if there's a process with the same name already running and, if so, activates the running app's window and then exits. The problem is that the main window could be hidden (only a notification area icon visible), thus leaving me with no window handle. At startup, previous instance's MainWindowHandle property is 0, so I can't send ShowWindow or PostMessage . Is there any way I can send a message that can be intercepted by the running app,

Use Visual Studio Setup Project to automatically register and GAC a COM Interop DLL

六月ゝ 毕业季﹏ 提交于 2019-12-28 01:55:39
问题 I've created a .NET assembly for COM interop and it is working well on my development machine. I'm currently trying to figure out how to deploy the DLL to a target machine using Visual Studio's "Setup Project." How can I use the VIsual Studio setup project to do the following things: Register the assembly (currently using regasm ). The assembly needs to be registered successfully and the type library (.tlb) needs to be registered successfully . This answer suggests scrapping regasm in favor

Is it possible to call a C function from C#.Net

和自甴很熟 提交于 2019-12-27 10:37:21
问题 I have a C lib and want to call function in this library from C# application. I tried creating a C++/CLI wrapper on the C lib by adding the C lib file as linker input and adding the source files as additional dependencies. Is there any better way to achieve this as am not sure how to add C output to c# application. My C Code - __declspec(dllexport) unsigned long ConnectSession(unsigned long handle, unsigned char * publicKey, unsigned char publicKeyLen); My CPP Wrapper - long MyClass:

Is it possible to call a C function from C#.Net

一世执手 提交于 2019-12-27 10:37:14
问题 I have a C lib and want to call function in this library from C# application. I tried creating a C++/CLI wrapper on the C lib by adding the C lib file as linker input and adding the source files as additional dependencies. Is there any better way to achieve this as am not sure how to add C output to c# application. My C Code - __declspec(dllexport) unsigned long ConnectSession(unsigned long handle, unsigned char * publicKey, unsigned char publicKeyLen); My CPP Wrapper - long MyClass: