com

ComImport in C#, how do you find GUID for classes like IFileDialog in shell32.dll?

耗尽温柔 提交于 2020-01-01 15:09:15
问题 I've been trying to setup some interop with some win32 classes in various dlls using ComImport for a C# application I'm writing. What I don't understand is how you find the GUID for a class? I found some examples of imports that work but I'm not sure how the authors found the GUID for the classes. An example of importing IFileDialog and one of its methods is listed below. [ComImport(), Guid("42F85136-DB7E-439C-85F1-E4075D135FC8"), InterfaceType(ComInterfaceType.InterfaceIsIUnknown)] internal

.NET2.0 C# Interop: How to call COM code from C#?

∥☆過路亽.° 提交于 2020-01-01 14:23:12
问题 In my last development environment, I was able to easily interact with COM, calling methods on COM objects. Here is the original code, translated into C# style code (to mask the original language): public static void SpawnIEWithSource(String szSourceHTML) { OleVariant ie; //IWebBrowser2 OleVariant ie = new InternetExplorer(); ie.Navigate2("about:blank"); OleVariant webDocument = ie.Document; webDocument.Write(szSourceHTML); webDocument.close; ie.Visible = True; } Now begins the tedious,

VB6 ActiveX exe - what is the proper registration sequence?

梦想与她 提交于 2020-01-01 12:03:12
问题 I have recently updated a Visual Basic 6 application that is an ActiveX exe, running on Windows XP. I have a couple of testers for this application who have received a copy of the exe and are attempting to run it. However, they are getting an error message "Unexpected error;quitting" when trying to do so. A key difference between their testing and my testing is that on the machines I tested on, I have admin rights and was able to register the application using the appname.exe /regserver

VB6 ActiveX exe - what is the proper registration sequence?

China☆狼群 提交于 2020-01-01 12:03:09
问题 I have recently updated a Visual Basic 6 application that is an ActiveX exe, running on Windows XP. I have a couple of testers for this application who have received a copy of the exe and are attempting to run it. However, they are getting an error message "Unexpected error;quitting" when trying to do so. A key difference between their testing and my testing is that on the machines I tested on, I have admin rights and was able to register the application using the appname.exe /regserver

WiX: register .NET COM component both x86 x64

断了今生、忘了曾经 提交于 2020-01-01 11:42:06
问题 I have C# COM .dll. I would like to install the .dll once, but have it be registered for both x86 and x64. Here's the WiX I have for registering only x64: <Component Id="NETDLL.dll" Directory="INSTALLDIR"> <File Id="NETDLL.dll" Name="NETDLL.dll" KeyPath="yes" Source="..\NETDLL.dll" /> <Class Id="{78BE...}" Context="InprocServer32" Description="NETDLL" ThreadingModel="both" ForeignServer="mscoree.dll"> <ProgId Id="NETDLL" Description="NETDLL" /> </Class> <RegistryValue Root="HKCR" Key="CLSID\

Create COM object from file without regsvr32

一世执手 提交于 2020-01-01 10:00:36
问题 Is it possible to create an instance of a COM object with just the dll and no regsvr32? My main goal here is to create an instance of a directshow filter and insert it into my graph-but I don't want to us regsvr32 to register the filter. The filter will be in a dll/ax that will be distributed with my application and will be present in my path. I will know the CLSID as well. So basically all I need is a way to create an instance of the type while just having the dll/ax and the CLSID. Is this

Create COM object from file without regsvr32

◇◆丶佛笑我妖孽 提交于 2020-01-01 10:00:04
问题 Is it possible to create an instance of a COM object with just the dll and no regsvr32? My main goal here is to create an instance of a directshow filter and insert it into my graph-but I don't want to us regsvr32 to register the filter. The filter will be in a dll/ax that will be distributed with my application and will be present in my path. I will know the CLSID as well. So basically all I need is a way to create an instance of the type while just having the dll/ax and the CLSID. Is this

“COM object that has been separated from its underlying RCW cannot be used” with .NET 4.0

感情迁移 提交于 2020-01-01 09:28:11
问题 I've a class in my .NET 3.5 C# WinForms application which has five methods. Each method uses different sets of C++ COM interfaces. Am using Marshal.FinalReleaseCOMObject for cleaning up these COM objects. This code works fine on this .NET platform without any issues. But when I move this application to .NET 4.0, I start getting this error in one of these methods at a line where I cast a variable from ICOMInterface1 to ICOMInterface2 , i.e.: ICOMInterface1 myVar= obj as ICOMInterface2; COM

“COM object that has been separated from its underlying RCW cannot be used” with .NET 4.0

旧街凉风 提交于 2020-01-01 09:28:09
问题 I've a class in my .NET 3.5 C# WinForms application which has five methods. Each method uses different sets of C++ COM interfaces. Am using Marshal.FinalReleaseCOMObject for cleaning up these COM objects. This code works fine on this .NET platform without any issues. But when I move this application to .NET 4.0, I start getting this error in one of these methods at a line where I cast a variable from ICOMInterface1 to ICOMInterface2 , i.e.: ICOMInterface1 myVar= obj as ICOMInterface2; COM

Expose an event handler to VBScript users of my COM object

梦想的初衷 提交于 2020-01-01 09:03:04
问题 Suppose I have a COM object which users can access via a call such as: Set s = CreateObject("Server") What I'd like to be able to do is allow the user to specify an event handler for the object, like so: Function ServerEvent MsgBox "Event handled" End Function s.OnDoSomething = ServerEvent Is this possible and, if so, how do I expose this in my type library in C++ (specifically BCB 2007)? 回答1: This is how I did it just recently. Add an interface that implements IDispatch and a coclass for