interop

Creating Win32 events from c#

谁说我不能喝 提交于 2019-12-21 03:43:19
问题 I'd like create a kernel(aka named events) from C#. Do I have to interop services and wrap the native CreateEvent function or is there already a .NET class that does the job? The function that I need to run should be something like this: hEvent = CreateEvent ( NULL , false , false , "MyCSHARPEvent" ); This should notify all procs that probing forMyCSHARPEvent about the event. If there is a need to wrap the function, how would I translate the SECURITY_ATTRIBUTES struct from C# to win32? 回答1:

How does Spark interoperate with CPython

有些话、适合烂在心里 提交于 2019-12-21 03:42:16
问题 I have an Akka system written in scala that needs to call out to some Python code, relying on Pandas and Numpy , so I can't just use Jython. I noticed that Spark uses CPython on its worker nodes, so I'm curious how it executes Python code and whether that code exists in some re-usable form. 回答1: PySpark architecture is described here https://cwiki.apache.org/confluence/display/SPARK/PySpark+Internals. As @Holden said Spark uses py4j to access Java objects in JVM from the python. But this is

C# Excel Interop: How to format cells to store values as text

∥☆過路亽.° 提交于 2019-12-21 03:19:14
问题 I'm writing numbers to an Excel spreadsheet from a DataTable and all of these numbers are 5 digits long with preceding 0s if the number itself is less than 5 digits long (so 395 would be stored as 00395, for example). When entering these numbers into Excel (using C#), it's storing them as numbers and eliminating the preceding 0s. Is there any way I can format the cells from C# in order to get the values to be stored as text rather than numbers? 回答1: You can SomeRange.NumberFormat = "@"; or if

How do I resize a WPF control inside a CWnd?

限于喜欢 提交于 2019-12-21 02:59:11
问题 I'm hosting a WPF UserControl inside an MFC CWnd . It works beautifully I now need to figure out how to resize the control with its parent. I've hooked the OnSize and I'm calling GetWindowRect and setting the result to my control like so: void CChildFrame::OnSize(UINT nType, int cx, int cy) { CRect rect; this->GetWindowRect(&rect); m_mainControl->Width = rect.Width(); m_mainControl->Height = rect.Height(); } 回答1: Eureka! The solution is to set the HwndSource.SizeToContent to SizeToContent

C# - Hook into existing COM object

試著忘記壹切 提交于 2019-12-21 02:42:21
问题 Say we have an existing process (or application) that calls a COM object from an ocx file such as "MyCOMLibrary.ocx". Is there a way to write a C# library to exactly replicate the ocx file? So that the original application can call your C# code rather than the original COM object? You would, of course, have to use identical CLSID and ProgIDs as the original ocx. And assuming there is no signing involved, such as a SNK in the .Net world. Also, are there any tools that exist to automate this?

C# Outlook interop and OpenSharedItem for opening MSG files

笑着哭i 提交于 2019-12-20 17:17:21
问题 Is there any tutorial or resource I can follow in order to use the OpenSharedItem outlook interop method. My goal is to read MSG files using it (as it can apparently do so). 回答1: How to: Create a Contact Item from a vCard file and Save the Item in a Folder How to: Import Saved Items using OpenSharedItem 回答2: Thanks Svetlozar, I've used the resources to create something like the following: Microsoft.Office.Interop.Outlook.Application app = new Microsoft.Office.Interop.Outlook.Application();

.NET and Lotus Notes Interop

别等时光非礼了梦想. 提交于 2019-12-20 09:44:38
问题 I've Lotus Notes database file (.nsf) at some location, let's say: http://intranet.mycompany.com/somewhere/data.nsf Is it possible in any way to read from that location using any .NET language? 回答1: Take a look at these resources: http://www.ibm.com/developerworks/lotus/library/domino-msnet/index.html http://www.codeproject.com/KB/cs/lotusnoteintegrator.aspx http://www.builderau.com.au/architect/database/soa/Create-an-ODBC-connection-to-a-Lotus-Notes-database/0,339024547,320282240,00.htm 回答2:

How can I save a very large MATLAB sparse matrix to a text file?

一个人想着一个人 提交于 2019-12-20 09:18:50
问题 I have a 30000x14000 sparse matrix in MATLAB (version 7), which I need to use in another program. Calling save won't write this as ASCII (not supported). Calling full() on this monster results in an Out of Memory error. How do I export it? 回答1: You can use find to get index & value vectors: [i,j,val] = find(data) data_dump = [i,j,val] You can recreate data from data_dump with spconvert, which is meant to "Import from sparse matrix external format" (so I guess it's a good export format): data

How to check if .net interoperability for excel is installed

落花浮王杯 提交于 2019-12-20 07:51:14
问题 I am using .net Primary Interoperability Assembly for Excel in my code. But, the application can be run on machine which doesn't have .net PIA for Excel installed. I want to give an error message if it is not installed Even though I am checking in GAC, to see if PIA is installed and only if it is present I am using Microsoft.Office.Interop.Excel related code. I am getting an error. My problem is - I am getting error which is - Unhandled Exception - can't find could not load file or assembly

Call method in already running .NET assembly from different app

孤街浪徒 提交于 2019-12-20 07:26:14
问题 I don't know if you can do this, but basicly I need to be able to call a method in already running .NET process from a different assembly that don't share the same process. Basically what I have is a application and when it calls a .net method it loads the assembly that contains that method into into a appdomian and then calls the method. I need to get from the loaded assembly into another process and call a supplied method. I know this might not help but this is picture of what happens: alt