interop

How to load an Excel Addin using Interop

青春壹個敷衍的年華 提交于 2019-11-29 04:33:30
I have an AddIn which I want to invoke through Excel interop from a C# winforms application. I can't get the addin etc. to load unless I uninstall and resinstall it each time (this is apparantly something to do with Excel not loading addins when you use interop - btw, can't get their example to work in C#). Unfortunately this is slow and annoying to the user so I need to streamline it. I want to have one instance of Excel but load an already installed addin without forcing this install/reinstall problem. I've searched and searched but everything I find on google gives the solution to install

Getting the helpstring attribute applied to C# properties exposed via COM interfaces

末鹿安然 提交于 2019-11-29 04:32:26
I'm currently working on a library that's to be exposed to COM for use in a legacy project that's being upgraded. I'm creating interfaces that are to be exposed, and they have properties on them with long, int, etc types. Using the DescriptionAttribute, I can get helpstrings generated in the .tlb for interfaces, classes, and methods, but for some reason it doesn't seem to want to work for properties. Is there anyway to get a helpstring generated in the TLB output for properties ? You have to put the attribute on the getter and setter individually. Like this: using System; using System

DllImport - PreserverSig and SetLastError attributes

那年仲夏 提交于 2019-11-29 04:09:28
On the MSDN I've found the following description for the two attributes: PreserveSig Set the PreserveSig field to true to directly translate unmanaged signatures with HRESULT or retval values; set it to false to automatically convert HRESULT or retval values to exceptions. By default, the PreserveSig field is true. SetLastError Enables the caller to use the Marshal.GetLastWin32Error API function to determine whether an error occurred while executing the method. In Visual Basic, the default is true (which adds some overhead); in C# and C++, the default is false. My question is: How these two

Why do Objective-C APIs return implicitly unwrapped optionals?

北城以北 提交于 2019-11-29 03:37:21
I am rather perplexed by this. If we take the method cellForRowAtIndexPath: in UITableView for example, it's method signature is: func cellForRowAtIndexPath(_ indexPath: NSIndexPath!) -> UITableViewCell! And its return value is: An object representing a cell of the table or nil if the cell is not visible or indexPath is out of range. That sounds like the perfect reason to use a standard optional. In fact, since all pointer based types in Objective-C can be nil... it seems to make sense that all Objective-C pointer types should be imported as standard optionals. I know from the WWDC talk that

Programmatically (C#) convert Excel to an image

吃可爱长大的小学妹 提交于 2019-11-29 03:00:12
问题 I want to convert an excel file to an image (every format is ok) programmatically (c#). Currently I'm using Microsoft Interop Libraries & Office 2007, but it does not support saving to an image by default. So my current work-around is as follows: Open Excel file using Microsoft Interop; Find out the max range (that contains data); Use the CopyPicture() on that range, which will copy the data to the Clipboard. Now the tricky part (and my problems): Problem 1: Using the .NET Clipboard class, I

How to access static inner Java class via Clojure interop?

和自甴很熟 提交于 2019-11-29 02:47:39
Basically what I need to do is this FileChannel.MapMode.READ_ONLY I tried doing the obvious (.. FileChannel MapMode READ_ONLY) but that ends up throwing an exception java.lang.NoSuchFieldException: MapMode even the / notation specified as for access static fields in the interop documentation produces the same exception (. (FileChannel/MapMode) READ_ONLY) You access inner classes with $ java.nio.channels.FileChannel$MapMode/READ_ONLY Martin Valjavec The syntax (FileChannel/MapMode) is a simplification and intended only for static fields and methods (for fields, you may even omit the parentheses

CUDA/OpenGL interop, draw to OpenGL texture with CUDA

你说的曾经没有我的故事 提交于 2019-11-29 02:42:38
问题 I am writing a rendering system in CUDA and want results to be quickly displayed via OpenGL, without touching main memory. I basically do the following: Create and initialize OpenGL texture, and register it in CUDA as cudaGraphicsResource GLuint viewGLTexture; cudaGraphicsResource_t viewCudaResource; void initialize() { glEnable(GL_TEXTURE_2D); glGenTextures(1, &viewGLTexture); glBindTexture(GL_TEXTURE_2D, viewGLTexture); { glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST);

interoperation between mercurial and subversion

孤街浪徒 提交于 2019-11-29 02:36:51
问题 A similar question has been asked recently, but is not the same. The Mercurial website has a detailed page listing comparisons for 4 different options for getting Mercurial and Subversion to interoperate. I am wondering if anyone out there has tried one or more of these, and could relate any really good or really bad experiences. The note on the hgsubversion download says hgsubversion is an extension for Mercurial that allows using Mercurial as a Subversion client. Right now it is not ready

disabling overwrite existing file prompt in Microsoft office interop FileSaveAs method

感情迁移 提交于 2019-11-29 02:02:17
I am using Ms Office Interop assemblies to create a MS Project file. To save the file created, I am using FileSaveAs method and it prompts a message saying that if you want to replace the existing file. I want to suppress the message, and I didn't find any parameter in FileSaveAs method for this purpose. Any Idea on this? I'am using C# as my programming language. dotNetkow I ran into this issue when working with Excel Interop. The best I've been able to find is to disable all Office alerts, like this: Microsoft.Office.Interop.MSProject.Application msProjectApp = new Microsoft.Office.Interop

Tips for using a C library from C#

梦想的初衷 提交于 2019-11-29 01:38:49
问题 I've got a library in C which I'd like to use from C#. From what I've gleaned off the internet, one idea is to wrap it in a C++ dll, and DllImport that. The problem is that the function I want to call has a fairly nasty parameter set: including a reference to a function (which will be a .NET function), and a couple of arrays (some write, some read). int lmdif(int (*fcn)(int, int, double*, double*, int*), int m, int n, double* x, double ftol, double xtol, double gtol, int maxfev, double epsfcn