com

Given a COM DLL, extract all classes CLSID and corresponding interface name

十年热恋 提交于 2019-12-03 13:51:57
My question is similar to Getting CLSID for a DLL file? , I think. I have a directory with some DLLs, each one implementing one or more COM interfaces. I would like to get: 1) Each interface name 2) The CLSID of the class implementing the interface For each DLL. It's important that everything can be done programatically (So I can't use some sort of COM browser and manually look up for that information). Later I will lookup the CLSID given the interface name and call some methods using IDispatch. One alternative seems to be scanning the registry trying to match the type, interface and class

Why is COM (Component Object Model) language-independent?

喜夏-厌秋 提交于 2019-12-03 13:36:12
I know that COM provides reusability at the binary level across languages and applications. I read that all components built for COM must adhere to a standard memory layout in order to be language-independent. I do not understand what "standard memory layout" means. What makes COM language-independent? stakx First, some technical background : C++ compilers usually generate something called a "vtable" for any class with virtual functions. This is basically a table of function pointers. The vtable contains a function pointer to every virtual method implemented by a class. In COM, interfaces are

Cannot call COM object created from STAThread from oher STA threads

房东的猫 提交于 2019-12-03 13:27:13
I am new to COM and trying to understand the difference between STA and MTA. I tried to create an example that would show that COM can manage calls to object created in STA that is not thread-safe. MyCalcServer class here is created using ATL Simple Object. The settings used are the same as in this article : Threading Model: Apartment Aggregation: No Interface: Custom MyCalcServer COM object is used in another C# project which is: class Program { [STAThread] static void Main(string[] args) { MyCOMLib.MyCalcServer instance = new MyCOMLib.MyCalcServer(); string output1; instance.ChangeValue(

IAudioSessionManager2 notifications not sent

别说谁变了你拦得住时间么 提交于 2019-12-03 13:23:20
问题 I'm trying to monitor new audio sessions via Windows 7's IAudioSessionManager2 COM interface (coupled with IAudioSessionNotification). Currently, IAudioSessionNotification::OnSessionCreated() is never called and I've run out of ideas as to why. Code registering custom IAudioSessionNotification: #define SAFE_RELEASE(comObj) \ if(comObj != NULL) \ { (comObj)->Release(); comObj = NULL; } BOOL success = false; HRESULT res; IClassFactory* pFactory; IMMDevice* pDevice; IMMDeviceEnumerator*

COM Interop: What should I do to make a C# property usable as a VARIANT from VBA

半腔热情 提交于 2019-12-03 13:03:40
Say I have a C# Nullable DateTime? property that needs to be consumed by VBA through COM. public DateTime? TestDate { get ; set; } Unfortunately, Nullables are not visible through COM, so I would like to have the property return a something that will be seen as a Variant from VBA. Unfortunately, I'm not sure how this should be written. I tried using an object and a dynamic instead of DateTime? : while I can get the property value, I can't set it (I get Run-Time error '424' Object required errors from VBA). Note : I don't have issues with making my library COM Visible: everything works fine and

How can I wrap a COM object in a native .NET class?

杀马特。学长 韩版系。学妹 提交于 2019-12-03 12:19:50
问题 I'm using an extensive existing COM API (could be Outlook, but it's not) in .NET (C#). I've done this by adding a "COM Reference" in Visual Studio so all the "magic" is done behind the scenes (i.e., I don't have to manually run tlbimp ). While the COM API can now be "easily" used from .NET, it is not very .NET friendly. For example, there are no generics, events are strange, oddities like IPicture , etc. So, I'd like to create a native .NET API that is implemented using the existing COM API.

How to distinguish different types of NaN float in Python

徘徊边缘 提交于 2019-12-03 12:10:59
I'm writing Python 2.6 code that interfaces with NI TestStand 4.2 via COM in Windows. I want to make a "NAN" value for a variable, but if I pass it float('nan') , TestStand displays it as IND . Apparently TestStand distinguishes between floating point "IND" and "NAN" values. According to TestStand help : IND corresponds to Signaling NaN in Visual C++, while NAN corresponds to QuietNaN That implies that Python's float('nan') is effectively a Signaling NaN when passed through COM. However, from what I've read about Signaling NaN , it seems that Signaling NaN is a bit "exotic" and Quiet NaN is

CreateObject equivalent for C# 4, dynamic keyword, and late binding?

霸气de小男生 提交于 2019-12-03 11:58:25
How do I create a dynamic COM/OLE/ActiveX object in C# 4.0 from a program identifier or ProgID (such as "Word.Application") without referencing a library? In C# 3.5 I'd have to write something like Type comObjectType = Type.GetTypeFromProgID(progId, true); Activator.CreateInstance(comObjectType); Is there an easier way to do it in C# 4.0 so I can assign it to a variable of type dynamic (using the dynamic keyword)? What's wrong with dynamic myTypeInstance = Activator.CreateInstance(Type.GetTypeFromProgID(typeName, true)); ? If it's a known type name, there's also dynamic myTypeInstance =

What is the difference between AxInterop and Interop?

删除回忆录丶 提交于 2019-12-03 11:00:33
I've added an .ocx to the toolbox in VS. Two .dll's were created: Interop.NNN.dll, AxInterop.NNN.dll. What is each one? Are they both required? The AxFoo.dll assembly contains an automatically generated class that's derived from the System.Windows.Forms.AxHost control. It is pretty simple, it has methods, properties and events, the same ones you have available in the .ocx, that simply call the Foo.dll interop library. So, yes, you definitely need to deploy both assemblies. Interop.xxx.dll and AxInterop.xxx.dll are runtime callable wrappers (RCW) for a referenced COM and an ActiveX dll

Is it possible for the .NET WebBrowser control to use IE9?

扶醉桌前 提交于 2019-12-03 10:38:58
I realise it's an early release and unstable. I wouldn't dream of swapping out the default webbrowser control for IE9 in any other project, but in this case I specifically need IE9 to compare alongside other versions. I'd like to have the .NET WebBrowser control use IE9 instead of the default version of IE on the machine. I have full control of the machine so it's no problem to hack away at system files or whatever else may be necessary. Normally, this could be achieved by installing the update to IE, but in IE9's case, it installs a separate application, leaving the current version of IE