com

How to get the System.Type of a Runtime Callable Wrapper class from its CLSID?

你。 提交于 2019-12-05 15:11:30
Note: For background information please see this related question: How to get LINQPad to Dump() System.__ComObject references? I am able to retrieve the CLSID of the RCW class corresponding to a COM object (obtained from another COM object, not initialized by my code) using IPersist.GetClassID() . Type.GetTypeFromCLSID() always returns the weakly-typed System.__ComObject , not the strongly-typed RCW class. I need to get the System.Type of the strongly-typed RCW class to be able to wrap the COM object with it using Marshal.CreateWrapperOfType() . Is this possible or is this a non-starter due to

COM - #include generated header vs #import generated tlb

…衆ロ難τιáo~ 提交于 2019-12-05 14:39:59
I have many projects of which generate COM DLL's, these projects output the following: projectname_i.h projectname_i.c projectname_p.c projectname_i.tlb Then where another project consumes this DLL it is used like so: #import "projectname.tlb" named_guids no_namespace I want to change this to use include instead of import. The reason behind wanting to change from #import to #include is because I want to enable the /MP compiler switch to speed up build times. http://msdn.microsoft.com/en-us/library/bb385193.aspx So what I would like to know is: Why do COM DLLs have a TLB and a H? Which should

DocumentComplete event in Embedded IWebBrowser2 using write() method

一笑奈何 提交于 2019-12-05 14:38:06
I've been looking hard for this but still have not found any solution. I'm using native win32 c++ (no MFC, ATL or .NET) I'm loading an html document with IHTMLDocument2->write(). I would like to get the event when the page is ready to show, meaning that all images and elements are downloaded and rendered. Following the embedded browser object from here embedded web control (IWebBrowser2), embedded javascript's onkeydown and onkeyup not firing and from here http://www.codeproject.com/Articles/3365/Embed-an-HTML-control-in-your-own-window-using-pla I managed to get an embedded web browser

Getting a slice of idle processing in managed component under unmanaged host

点点圈 提交于 2019-12-05 14:21:43
I have a managed component written in C#, which is hosted by a legacy Win32 app as an ActiveX control. Inside my component, I need to be able to get what normally would be Application.Idle event, i.e. obtain a time slice of the idle processing time on the UI thread (it has to be the main UI thread). However in this hosted scenario, Application.Idle doesn't get fired, because there is no managed message loop (i.e., no Application.Run ). Sadly, the host also doesn't implement IMsoComponentManager , which might be suitable for what I need. And a lengthy nested message loop (with Application

Difference between COM DLL and ActiveX control

不打扰是莪最后的温柔 提交于 2019-12-05 12:52:35
问题 Few similarities I know.. Both cannot execute by themself. It needs some program to instantiate it. COM DLL & ActiveX controls are platform independant. (is it so...?) Both requires to support the interface IUnknown and exposes three methods QueryInterface , AddRef , and Release . It also requires to be registered before using and un-registered after done with it. But how are they different? Can someone please list it down? Also my understanding is ActiveX controls are OLE custom controls

Connecting to WMI: 0x800706ba errors on some machines (but not all)

江枫思渺然 提交于 2019-12-05 12:30:05
When I try to connect to WMI from Powershell, ConfigMgr, or WMI explorer, I can talk to the majority of my computers, but some (maybe 30%?) return an 0x800706ba (RPC server is unavailable). If I turn the firewall off on the remote machine, the queries start working. I have tried a bunch of different configurations of firewall settings, though, and I can't seem to figure out what the right combination of exceptions is. Here's the relevant bits of my firewall config on the remote machine. The crazy part is that there are no drops listed in pfirewall.log when it doesn't work - but again, if I

Would adding a new function to the existing COM interface break its binary compatibility?

大城市里の小女人 提交于 2019-12-05 12:27:03
I want to add a new method to a COM interface with all the existing one unchanged, will this break its compatibility for the consumer before this update? It depends: if this is an internal unpublished interface, you are free to change it at will so long as you control all the code that interacts with that interface. Once published, however, the rules are strict: every interface has its own IID. You change that interface in any way - by modifying, adding or removing methods - it's a whole new interface, and requires a new IID. However: COM does doesn't care how that new interface is implemented

What's the Matlab equivalent of NULL, when it's calling COM/ActiveX methods?

不问归期 提交于 2019-12-05 12:18:25
问题 I maintain a program which can be automated via COM. Generally customers use VBS to do their scripting, but we have a couple of customers who use Matlab's ActiveX support and are having trouble calling COM object methods with a NULL parameter . They've asked how they do this in Matlab - and I've been scouring Mathworks' COM/ActiveX documentation for a day or so now and can't figure it out. Their example code might look something like this: function do_something() OurAppInstance = actxserver(

Exposing C# struct to COM breaks for VB6 app

妖精的绣舞 提交于 2019-12-05 12:01:55
Last Updated: 2009-08-11 2:30pm EDT A few days ago I posted this question about some very strange problems. Well, I figured out what specifically was causing a build on one machine to not run on others and even came up with a work-around, but now it leaves me with a nice, specific question: Why? To reproduce the problem, I create a new InteropUserControl and do the following: Add a new public struct MyStruct : Give it a GUID and ComVisible attributes Add a GetMyStruct member to the _InteropUserControl interface and implement it in InteropUserControl . MyStruct : [Guid("49E803EC-BED9-4a08-B42B

What is the difference between a COM string (BSTR) and a .NET string?

陌路散爱 提交于 2019-12-05 11:40:15
Is it just the way the bytes are combined to "encode" the data? I'm curious because I wonder how an RCW automatically takes a .NET string and transforms it into a COM BSTR. I'm guessing it just forms a valid COM BSTR transformed from the .NET string. Related: Could I construct my own valid BSTR using a byte type in .NET? The two string types are not related at all. A transformation has to occur to convert one type to another. A BSTR has a number of conventions that must be followed in including allocated via SysAllocString*, deallocated with SysFreeString, having a length prefix, and a