interop

C#: State of a Checkbox in MS Excel

时光怂恿深爱的人放手 提交于 2021-02-08 05:15:27
问题 I am trying to acquire state of a checkbox existing in an XLS document via C#. Let me back up here. This is what I have: MS Office 2007 + Dev Tools and VC# 2010 Express Referenced MS Excel 12.0 Object Library An XLS document I successfully retrieve the Excel.Shape object. However, I am stuck when trying to determine whether it is checked or not. So far I have acquired its AutoShapeType, which says msoShapeMixed. Can someone point me to the right direction? Thanks! class Program { static void

gzinflate in Java

流过昼夜 提交于 2021-02-08 04:38:22
问题 So, my Java application reveives some data that is generated with PHP's gzdeflate(). Now i'm trying to inflate that data with Java. This is what i've got so far: InflaterInputStream inflInstream = new InflaterInputStream(new ByteArrayInputStream(inputData.getBytes() ), new Inflater()); byte bytes[] = new byte[1024]; while (true) { int length = inflInstream.read(bytes, 0, 1024); if (length == -1) break; System.out.write(bytes, 0, length); } 'inputData' is a String containing the deflated data.

C# marshal unmanaged pointer return type

馋奶兔 提交于 2021-02-07 11:59:52
问题 I have an unmanaged library which has a function like this: type* foo(); foo basically allocates an instance of the unmanaged type on the managed heap through Marshal.AllocHGlobal . I have a managed version of type . It's not blittable but I have MarshalAs attributes set on members so I can use Marshal.PtrToStructure to get a managed version of it. But having to wrap calls to foo with extra bookkeeping to call Marshal.PtrToStructure is a bit annoying. I'd like to be able to do something like

Access .NET generic objects from VBA

血红的双手。 提交于 2021-02-07 09:16:28
问题 My .net code has an object with a number of generic properties. This object is returned to the VBA code. All the non-generic properties are working well, but I also need to access the generic values. Is there a way to do it from VBA? [ClassInterface(ClassInterfaceType.AutoDual)] public class Obj { public string GetProp1() {...} public IList<MyCustomType> GetProp2() {...} } VB code: Sub Test() Dim o As Program.Obj Set o = New Program.Obj Set p2 = hp.GetProp2() set p2_0 = p2(0) ' doesn't work

Access .NET generic objects from VBA

穿精又带淫゛_ 提交于 2021-02-07 09:14:09
问题 My .net code has an object with a number of generic properties. This object is returned to the VBA code. All the non-generic properties are working well, but I also need to access the generic values. Is there a way to do it from VBA? [ClassInterface(ClassInterfaceType.AutoDual)] public class Obj { public string GetProp1() {...} public IList<MyCustomType> GetProp2() {...} } VB code: Sub Test() Dim o As Program.Obj Set o = New Program.Obj Set p2 = hp.GetProp2() set p2_0 = p2(0) ' doesn't work

Registration-Free COM Interop and Dependent Assemblies

亡梦爱人 提交于 2021-02-07 02:50:30
问题 We are working on an integration of a large MFC-based application with a handful of managed (.NET) add-ins. Communication with these add-ins is done via COM. Historically, we've just used the registry to make these add-ins available (as COM servers) to the application. But, now we're trying to use registration-free COM interop to do this. We'd like these add-ins to be able to live in a separate directory from the one that the application is running in -- ideally anywhere. But, we're

Registration-Free COM Interop and Dependent Assemblies

狂风中的少年 提交于 2021-02-07 02:50:05
问题 We are working on an integration of a large MFC-based application with a handful of managed (.NET) add-ins. Communication with these add-ins is done via COM. Historically, we've just used the registry to make these add-ins available (as COM servers) to the application. But, now we're trying to use registration-free COM interop to do this. We'd like these add-ins to be able to live in a separate directory from the one that the application is running in -- ideally anywhere. But, we're

C++/CLI delegate as function pointer (System.AccessViolationException)

蹲街弑〆低调 提交于 2021-02-06 15:15:48
问题 I have been experimenting with C++/CLI delegates (as I am trying to make a .NET reference library), and I have been having the following problem. I define a delegate in C++/CLI, and then create an instance of the delegate in C#, and then call the instance of the delegate through unmanaged C++ via a function pointer. This all works as expected. Code to illustrate this (first my C#) using System; namespace TestProgram { class Program { static void Main(string[] args) { Library.Test

C++/CLI delegate as function pointer (System.AccessViolationException)

纵饮孤独 提交于 2021-02-06 15:14:34
问题 I have been experimenting with C++/CLI delegates (as I am trying to make a .NET reference library), and I have been having the following problem. I define a delegate in C++/CLI, and then create an instance of the delegate in C#, and then call the instance of the delegate through unmanaged C++ via a function pointer. This all works as expected. Code to illustrate this (first my C#) using System; namespace TestProgram { class Program { static void Main(string[] args) { Library.Test

C++/CLI delegate as function pointer (System.AccessViolationException)

旧巷老猫 提交于 2021-02-06 15:11:48
问题 I have been experimenting with C++/CLI delegates (as I am trying to make a .NET reference library), and I have been having the following problem. I define a delegate in C++/CLI, and then create an instance of the delegate in C#, and then call the instance of the delegate through unmanaged C++ via a function pointer. This all works as expected. Code to illustrate this (first my C#) using System; namespace TestProgram { class Program { static void Main(string[] args) { Library.Test