interop

System.Data.SQLite from NuGet, interop dll not copied to output directory

不羁岁月 提交于 2020-01-29 10:21:05
问题 I installed System.Data.SQLite Core (x86/x64) from NuGet. It built without warnings but threw System.DllNotFoundException regarding SQLite.Interop.dll . I rigged my projects to copy the SQLite.Interop.dll from under the NuGet package's directory to the output directory, and now it runs without the exception. Why didn't the NuGet package configure my projects to put the appropriate interop dll in the output directory? It seems like it should be able to do that. I'm new to interop and I

Interop between F# and C# lambdas

徘徊边缘 提交于 2020-01-27 22:40:56
问题 F# powerpack comes with a set of conversion methods to translate from Func<...> to F# functions, either standard or tupled ones. But is it possible to achieve the opposite: in case you want to call from F# code a C# method that takes Func<...> and want to use native F# lambda expression (e.g. fun x -> some_function_of(x))? If I send a F# function with a signature 'a -> 'b to a C# method that expects Func then F# compiler generates the following error: This expression was expected to have type

Interop between F# and C# lambdas

好久不见. 提交于 2020-01-27 22:39:53
问题 F# powerpack comes with a set of conversion methods to translate from Func<...> to F# functions, either standard or tupled ones. But is it possible to achieve the opposite: in case you want to call from F# code a C# method that takes Func<...> and want to use native F# lambda expression (e.g. fun x -> some_function_of(x))? If I send a F# function with a signature 'a -> 'b to a C# method that expects Func then F# compiler generates the following error: This expression was expected to have type

Does proxy/stub expose the interface?

血红的双手。 提交于 2020-01-26 03:26:46
问题 Suppose I introduced a COM interface and don't want any third party to use it. I have full control over the sources of the COM component and the IDL file that holds the interface definition. My COM component will need marshalling stuff fro that interface, so I'll need to either implement IMarshal or provide a typelib or provide a proxy/stub. Obviously if I provide a typelib anyone can inspect it and find what my interface is and how it can be used. That's not what I want. What if I use proxy

Fill struct from IntPtr received in lParam property of Window Message going across process boundaries in C#

柔情痞子 提交于 2020-01-25 10:35:08
问题 I posted this question a few days ago, and I have some follow up doubts about marshaling an IntPtr to a struct. The thing goes like this: As stated in the question I am referencing, I make calls to asynchronous methods on a native Dll. These methods communicate their completion with Windows Messages. I receive the Windows Message correctly now and, within it, an lParam property (of type IntPrt). According to the documentation I am following, this lParam points to the struct that has the

Ruby - Calling commands and interact with shell in Windows environment

邮差的信 提交于 2020-01-25 10:02:48
问题 I am running an .exe file in the command line from a Ruby script that asks the user for a Yes/No response. I would like to know how the user can interact with it in Windows environment. I have tried all the possible options: system , backticks, %x() , Open3, Open4... and none of them work. Some posts ([1], [2]) resolve the issue using PTY, but as to my knowledge there is no implementation of the PTY module in Windows. Any other idea? 回答1: Seems this is working under Windows too pipe = IO

How to inject text to the cursor focus

╄→гoц情女王★ 提交于 2020-01-25 08:49:05
问题 I am developing a .NET windows app that needs to insert text in the place where the cursor is. The cursor will be in a different application that I have no control over. I think the operating system needs to be used here to achieve this. Can you help please? 回答1: Put the text you want to insert into the clipboard Find the window's handle: Process[] processes = Process.GetProcessesByName("notepad"); foreach (Process p in processes) { IntPtr pFoundWindow = p.MainWindowHandle; // Do something

how can i create an excel file using Interop on c++

*爱你&永不变心* 提交于 2020-01-24 21:31:48
问题 I've searched a lot of info, about the easiest way to create and edit excel files to save some login and passwords of my program. I've seen lots of C# methods and I don't understand it a lot. I've added a reference to Visual Studio 2010 Microsoft.Office.Interop.Excel (I'm using Office 2010). I don't know how to take this further, however; what headers should I add, what else should I do? I can't find any tutorial of C++ using this on their projects. I just want something simple. EDIT: I will

Marshal a double char pointer return value

家住魔仙堡 提交于 2020-01-24 19:52:04
问题 A C library I'm using has a function which returns a pointer to an array of char pointers: extern char** getIds(); The example of use: char **list, **list_save; list_save = list = getIds(); while (list && *list) { printf("Id: %s\n", *list); list++; } freeIds(list_save); Where freeIds is also from the C library, and frees the memory allocated during getIds . They provide a .Net Interop assembly too, but it doesn't import the getIds function. I have access to the interop assembly source code.

Shell_NotifyIconA / Shell_NotifyIconW…whats the difference?

空扰寡人 提交于 2020-01-24 13:58:07
问题 I am porting some Win32 code to C#, and have come accross several functions which have the same names and use the same structures except that they end with A and W For example: [return: MarshalAs(UnmanagedType.Bool)] [DllImport("shell32.dll", CallingConvention = CallingConvention.StdCall)] public static extern bool Shell_NotifyIconA(uint dwMessage, ref NOTIFYICONDATAA lpData); [return: MarshalAs(UnmanagedType.Bool)] [DllImport("shell32.dll", CallingConvention = CallingConvention.StdCall)]