interop

Visual Studio 2010, TlbImp generates .net 4.0 interops in 2.0 projects

荒凉一梦 提交于 2019-12-01 02:26:52
In a C# project we add a reference to a COM object via the Add References setup pointing to a COM object which results in the IDE auto-generating the interop assembly. So this is fine and good, but we are building based on .net 3.5 SP1 aka CLR 2.0, and the generated interops are using the 4.0 CLR making them incompatible. Is there a way to prevent this? I assume the other option is configure our build script to try using tlbimp.exe with the /references parameter? to point to mscorlib v2.0? Anyhow, I'm hoping there's a flag somewhere to allow this. I encountered exactly this issue. The solution

Passing string array from VB6 to C#.net

安稳与你 提交于 2019-12-01 02:12:12
问题 How to pass a VB6 string array [Assume, s =Array("a", "b", "c", "d")] to C#.Net through COM Interop? I tried to implement passing C# string array to VB and VB string array to C# as below C#->VB working fine but other way (VB=>C#) giving a compile error called "Function or interface marked as restricted, or the function uses an automation type not supported in visual basic" . My code below C# public interface ITest { string[] GetArray(); void SetArray(string[] arrayVal ); } public class Test :

Does WCF FaultException<T> support interop with a Java web service Fault

早过忘川 提交于 2019-12-01 00:48:08
I have written a java axis2 1.4.1 web service and .net 3.5 WCF client and I am trying to catch the wsdl faults thrown. Unlike .net 2.0 the .net 3.5 claims to support wsdl:fault and the service reference wizard does generate all the correct fault classes in the client proxy. But when I try to catch a fault it doesn't seem to correctly serialise so that I can only catch (FaultException ex) and not the type I actually threw using FaultException<T> I had a look inside my reference.cs I can see wizard has added correct FaultContract to the my opeation. [System.CodeDom.Compiler

COM interop object throws InvalidCastException in one project but not in other

最后都变了- 提交于 2019-12-01 00:35:13
I have a COM object I imported in my test C# solution. Everything works fine and continues to do so. Then I imported the same COM object in my actual solution and as a test implemented the exact same lines as in the test project. When I run the real project I get an InvalidCastException Unable to cast COM object of type 'CTWebReport.WebReportCOMClass' to interface type 'CTWebReport.IWebReportCOM'. This operation failed because the QueryInterface call on the COM component for the interface with IID '{5DFA18E8-4E71-4ADC-A812-6B166C242561}' failed due to the following error: No such interface

C# - Java interoperation

核能气质少年 提交于 2019-11-30 23:39:04
Can you give me some pointers on making C# code and Java code interoperate? Let's define the interoperation as something simple: allow (from Java code) the instantiantion and method calling of a class defined in C#, and, possibly, the other way around as well. Is this even possible natively ? (i.e. without some proxy/skeleton interface mechanism) And finally, what proxy mechanisms can be used? (i.e. are supported by both language realms) I've used IKVM to accomplish this successfully. I've found a very promising article on CodeProject here . Excerpt from the article introduction: The suggested

Calling unmanaged C++ library (dll) from C# creates an access violation error (0xc0000005)

廉价感情. 提交于 2019-11-30 23:26:16
Sorry for the long question. I just wanted to include everything that I know about the problem at the moment. I'm using Visual Studio 2008 to create a Windows Form program in C# that calls a library written in C++. The C++ DLL analyzes measurement data, which consists of several samples. The samples are passed to the library by a function ( PDSetWaveSample ) which takes a struct as a parameter. After all samples are set, the measurement data is processed with another function ( PDPreProcess ) which also takes a struct as a parameter. The C++ DLL is holding all the measurement data in its

.NET Interop: Find All instances of of a running COM object with C#

安稳与你 提交于 2019-11-30 22:43:19
Background I am automating some Office application (Word and PowerPoint) via command-line tool. One thing my tool needs to do is locate all the running instances of Word. I know how to get a reference to one of the instances... Object running_obj = null; { running_obj = System.Runtime.InteropServices.Marshal.GetActiveObject(progid); } catch (System.Exception) { //failed to find the object; } if (running_obj!=null) { var running_obj_type = System.Type.GetTypeFromProgID(progid); Microsoft.Office.Interop.Word.Application running_obj_wrapper; running_obj_wrapper = (Microsoft.Office.Interop.Word

CUDA + OpenGL Interop without deprecated functionality

|▌冷眼眸甩不掉的悲伤 提交于 2019-11-30 22:13:28
I've previously been able to populate textures in CUDA for use in OpenGL by: Create and initialize the GL texture ( gl::GenTextures() , etc.) Create a GL Pixel Buffer Object Register the PBO with CUDA In the update/render loop: cudaGraphicsMapResource() with the PBO Launch the kernel to update the PBO cudaGraphicsUnmapResource() the PBO from CUDA Load the GL program, bind texture, render as normal Wash, rinse repeat. However, I'm wondering if PBOs are still the best way to write a texture from a kernel. I've seen articles like this one ( updated for v5 here ) which don't appear to use PBOs at

Visual Studio 2010, TlbImp generates .net 4.0 interops in 2.0 projects

早过忘川 提交于 2019-11-30 22:01:09
问题 In a C# project we add a reference to a COM object via the Add References setup pointing to a COM object which results in the IDE auto-generating the interop assembly. So this is fine and good, but we are building based on .net 3.5 SP1 aka CLR 2.0, and the generated interops are using the 4.0 CLR making them incompatible. Is there a way to prevent this? I assume the other option is configure our build script to try using tlbimp.exe with the /references parameter? to point to mscorlib v2.0?

C# Excel interop: Exception from HRESULT (DISP_E_BADINDEX)

泪湿孤枕 提交于 2019-11-30 21:15:18
I'm trying to deploy an application that works fine on my development pc and some other workstations. However, some users receive an error that I can't seem to grasp. The program is a C# dotNet app with Excel.Interop functionality (Office 2003). I seem to be getting a problem with 'indexes'. The weird thing is that this part works perfect on some machines but throws a fatal exception on others... All machines are Windows 7 with Office 2003. This is the relevant code: //Change sheet code (index is 1, 2, 3) -> errors at #2 public void ChangeWorksheet(int sheetIndex) { if (_OnXLSEvent != null)