interop

pointers between c# and c++ - p/invoke

拈花ヽ惹草 提交于 2019-12-13 04:26:31
问题 hi im trying to call some c++ code from c#. So i followed several tutorials, amde my own dll, and now i call it from my c# wrapper. the thing is, i have a function that receives a pointer and i can't seem to make it work, visual studio just shows me red errors that i don't understand very well. can someone tell me what im doing wrong? and i have another question, if the functions in c++ call other functions, all the data will remain intact right? because this array that i pass will be

Do I need to force the GAC to reload an assembly? Is this possible?

ぐ巨炮叔叔 提交于 2019-12-13 04:12:50
问题 I've added types to my .NET classes that I'm using for COM interop. To get it to work with my VB6 application, I unregistered the DLL and re-registered it (using regasm ). I then uninstalled and reinstalled it to the GAC (using gacutil ). The types are showing up in the VB6 object explorer, but when I run the application in the VB6 IDE, it breaks on the line that instantiates the new types with the error: Automation Errror - The System cannot find the file specified . I thought this odd since

How to fire property changed notifications from C# to COM using IPropertyNotifySink?

青春壹個敷衍的年華 提交于 2019-12-13 04:07:36
问题 I am going crazy on this problem for the past couple of weeks. I have a C# Com object that needs to send property change notifications to a C++ Com object. An equivalent in VB would be using code that looks as follows PropertyChanged "propertyName". In C++ the equivalent to use the CFirePropNotifyEvent class from ATL. The C++ COM and VB COM objects do not implement a specialized events interface, so the equivalent are give above.. The C++ COM object that needs to sink the event is based

C# pointer to unmanaged struct with array

拟墨画扇 提交于 2019-12-13 02:53:59
问题 I am trying to implement a C style struct in C# for interoperability. Here is the struct I'm trying to convert: typedef struct { UINT8 TrafficClass0:4; UINT8 Version:4; UINT8 FlowLabel0:4; UINT8 TrafficClass1:4; UINT16 FlowLabel1; UINT16 Length; UINT8 NextHdr; UINT8 HopLimit; UINT32 SrcAddr[4]; UINT32 DstAddr[4]; } DIVERT_IPV6HDR, *PDIVERT_IPV6HDR; And here is my C# struct: [StructLayoutAttribute(LayoutKind.Sequential)] public struct DivertIPv6Header { /// TrafficClass0 : 4 /// Version : 4 //

WPF, Flash and Airspace

╄→尐↘猪︶ㄣ 提交于 2019-12-13 02:17:43
问题 Has anyone been able to solve the airspace issues when trying to play a flash (swf) movie in a WPF application? I've been able to play the swf file using a WinForms control and a WindowsFormsHost element, and also using the WebBrowser element - but both have the airspace issues. 回答1: It depends on exactly what you're trying to do but I've used a transparent overlay window with success. Track the underlying window's location and update the overlay window's position accordingly. Ensure that you

How to build a interop dll from the UIAutomationClient.dll

拥有回忆 提交于 2019-12-13 01:05:56
问题 I want to create / build a interop dll from the existing UIAutomationClient.dll Version 4.0.. I tried to use the TlbImp.exe with the following command: TlbImp.exe path\UIAutomationClient.dll out:Interop.UIAutomationClient.dll But i'm getting the following error message: Microsoft (R) .NET Framework Type Library to Assembly Converter 4.0.4013 Copyright (C) Microsoft Corporation. All rights reserved. TlbImp : error TI0000 : The input file 'C:\Users\patrick\Desktop\UIAutomationCli ent.dll' is

Get Service Status Handle after initializing service

送分小仙女□ 提交于 2019-12-13 01:02:36
问题 I am calling the Win32 API from .Net 1.1 to request additional startup time for a service (.Net 2.0 and up is not an option currently). Here is the pseudo-code I am calling within the OnStart() method. private void OnStart(){ private IntPtr statusHandle; private IntPtr serviceHandle; private IntPtr serviceControlManagerHandle; serviceControlManagerHandle = ServiceUtil.OpenSCManager(null, null, (uint)ServiceUtil.SCM_ACCESS.SC_MANAGER_ALL_ACCESS); serviceHandle = ServiceUtil.OpenService

Sending data from a PHP script to a C# applicaiton

谁说胖子不能爱 提交于 2019-12-13 00:18:19
问题 When C# app is ran, it POSTS a request to the PHP server, which wants to return an array. What's an easy way to load this array's contents into C# for using with there. For clarification, this array is a PHP stdClass object that contains strings, floats, and other stdClass objects. I want to get a similar data structure on the C# end with the same data. Also, I know stdClass != arrays, but they're pretty simular so that they can be encoded the same way witn most encoding mechanisms. 回答1: I

C++ calling C# COM interop error: HRESULT 0x80131509

不问归期 提交于 2019-12-12 22:33:02
问题 I create a C# COM interop for c++ to invoke. I have registered the dll and tlb file by regasm. everything goes well till one day i changed code of C# part (i didn't change the definition of interface, just implementation changed). one interface in COM returns an error 0x80131509. the strange thing is, it is only happened in some computers (my develop PC is works well so i can't debug this problem). I'm not really clear on how the C# COM worked with C++, after i registered them, i just know

find out if there are hidden columns in excel

筅森魡賤 提交于 2019-12-12 22:13:54
问题 I need to know if there hidden columns in the excel sheet. i used use the following which worked fine and then suddenly it stopped working.now it always returns false. bool.Parse(worksheet.PageSetup.Application.Columns.Hidden.ToString()) TIA excel 2007 .net 3.5 回答1: Refactor the following snippet of code as required. Option Strict Off Imports System Imports System.Console Imports Microsoft.Office.Interop Public Class AreThereHiddenColumnsInExcelWorkSheet Public Shared Sub Execute() Dim excel