interop

passing a complex object in c++ to c# through COM

匆匆过客 提交于 2019-12-08 06:09:02
问题 This question expands on the existing question here: Passing an object from C++ to C# though COM The previous question deals with a simple object, but I would like to do the same for a complex object. So instead of TestEntity1 having a single property, if it has another property of type TestEntity2, how can I assign the property of type TestEntity2 of the TestEntity1 object in c++ consumer? C#: using System; using System.Collections.Generic; using System.Text; using System.Runtime

How to know which COM component is called by a certain PIA?

梦想的初衷 提交于 2019-12-08 06:03:22
问题 I got a PIA installed on my box, it is Microsoft.mshtml . If I understandd it correctly, these PIA is provided by Microsoft to ease our life of COM interop. But I want to know which COM component is actually wrapped/called by this PIA. Because I am having a UnauthorizedAccessException, I want to locate the actual COM component and use dcomcnfg.exe to grant it proper permission. I hope this is the right direction. Thanks! 回答1: It is c:\windows\system32\mshtml.dll. I seriously doubt that

Access MS-Word spell-checker from (unmanaged) C++

南楼画角 提交于 2019-12-08 05:37:56
问题 I found a few articles on interacting with the MS-Word spell-checker from C# and managed C++ using .NET. (For anyone interested: this and this) But I couldn't find anything comparable on doing it through standard unmanaged C++ in an MFC app, using COM. I assume the .NET examples are actually using COM meaning it's possible, but is it likely to be horrific and ugly to do? 回答1: I did this. It is not that complicated. I packed the whole thing in a DLL and made the suggestions-dialog myself.

Excel file operations using interop in multithreaded C# application fails

痴心易碎 提交于 2019-12-08 05:36:17
问题 I've an application that automates some file related jobs. Every job is executed inside separate threads. One kind of job is exporting an Excel file to HTML format. I use Microsoft.Office.Interop.Excel namespace for this purpose. My application was working fine under Windows Server 2008 environment but we upgraded our server to Windows Server 2012 and I started to get the following error : The message filter indicated that the application is busy. (Exception from HRESULT: 0x8001010A (RPC_E

Using P/Invoke correctly

扶醉桌前 提交于 2019-12-08 05:10:01
问题 I need to call an external dll from c#. This is the header definition: enum WatchMode { WATCH_MODE_SYSTEM = 0, WATCH_MODE_APPLICATION = 1 }; LONG ADS_API WDT_GetMode ( LONG i_hHandle, WatchMode * o_pWatchMode ); I've added the enum and the call in C#: public enum WatchMode { WATCH_MODE_SYSTEM = 0, WATCH_MODE_APPLICATION = 1 } [DllImport("AdsWatchdog.dll")] internal static extern long WDT_GetMode(long hHandle, ref WatchMode watchmode); This generates an AccessViolationException. I know the dll

Getting data from C# to Excel 03/07

▼魔方 西西 提交于 2019-12-08 05:06:45
问题 I have files with tons of real time data that I process with an C# application. After processing the data it is presented in Excel using a specific template. This is solved using Interop today. I must say I don't completely gasp the whole Interop situation. Do I have to manually install the Interop functionality on each end user terminal somehow? How does it handle the mix of 2003/2007 versions? 回答1: If you know the structure of your Excel document (and presuming you don't want and kind of

How to work around unsupported unsigned integer field types in MS SQL?

妖精的绣舞 提交于 2019-12-08 04:24:29
问题 Trying to make a MySQL-based application support MS SQL, I ran into the following issue: I keep MySQL's auto_increment as unsigned integer fields (of various sizes) in order to make use of the full range, as I know there will never be negative values. MS SQL does not support the unsigned attribute on all integer types, so I have to choose between ditching half the value range or creating some workaround. One very naive approach would be to put some code in the database abstraction code or in

C#/COM interop working only in debugger

时光毁灭记忆、已成空白 提交于 2019-12-08 04:21:52
问题 I have a problem with COM interop from a C# application to an inproc COM server component. I have reduced the problem to a simple c# test program. It instantiates the server component's interop class, sets the value of a string a property on the instance, and then sets another string property. I'm not doing anything unusual with marshalling. Just using the interop class generated when I added a reference to the COM component. Something like: using MyLib; // Interop assy // ... MyComp comp =

Scala/Java interop: class type not converted?

会有一股神秘感。 提交于 2019-12-08 04:06:26
The javafx api is defined like this: void addListener(ChangeListener<? super java.lang.Boolean> listener) The following code.. new TextArea().focusedProperty.addListener(new ChangeListener[Boolean]() { def changed(observable: ObservableValue[_ <: Boolean], oldValue: Boolean, newValue: Boolean) { } }) ..gives this error: overloaded method value addListener with alternatives: (javafx.beans.value.ChangeListener[_ >: java.lang.Boolean])Unit (javafx.beans.InvalidationListener)Unit cannot be applied to (java.lang.Object with javafx.beans.value.ChangeListener[Boolean]) If I use java.lang.Boolean

Use VB to distinguish between an xlsx event from C# Interop or Excel program

随声附和 提交于 2019-12-08 04:00:43
问题 I have an event that I want triggered when a user closes a .xlsx file. I also have a C# program that regularly checks the content within that same file. The problem I have is that when my C# program (which uses Interop) closes the .xlsx file, it triggers my VB code. Is there a way to isolate access to the excel file so that I know it was edited within the Excel program? I only want my VB code triggered when a user edits the file within Excel. Thanks 回答1: I decided to simply have my C# program