idispatch

How does CreateStdDispatch know what method to invoke?

北城以北 提交于 2019-12-04 10:57:35
i'm faced with implementing an IDispatch interface. There are four methods, and fortunately 3 of them are easy: function TIEEventsSink.GetTypeInfoCount(...): HResult; { Result := E_NOTIMPL; } function TIEEventsSink.GetTypeInfo(...): HResult; { Result := E_NOTIMPL; } function TIEEventsSink.GetIDsOfNames(...): HResult; { Result := E_NOTIMPL; } It's the last method, Invoke that is difficult. Here i am faced with having to actually case the DispID , and call my appropriate method; unmarhsalling parameters from a variant array. function Invoke( dispIdMember: DISPID; riid: REFIID; lcid: LCID; wFlags

Implementing IDispatch in c#

烈酒焚心 提交于 2019-12-04 05:32:01
I'm writing some test code to emulate unmanaged code calling my c# implementation of a late binding COM object. I have an interface that is declared as an IDispatch type as below. [Guid("2D570F11-4BD8-40e7-BF14-38772063AAF0")] [InterfaceType(ComInterfaceType.InterfaceIsDual)] public interface TestInterface { int Test(); } [ClassInterface(ClassInterfaceType.AutoDual)] public class TestImpl : TestInterface { ... } When I use the code below to call IDispatch's GetIDsOfNames function .. //code provided by Hans Passant Object so = Activator.CreateInstance(Type.GetTypeFromProgID("ProgID.Test"));

COM / OLE / ActiveX / IDispatch confusion

时光怂恿深爱的人放手 提交于 2019-12-03 03:23:50
I can't wrap my head around the differences among these terms. Are COM and ActiveX synonyms? Is ActiveX object just a COM object that exposes IDispatch? Lots of older MSDN pages mention IDispatch without any COM context. Does it have a separate history, and was just introduced under the COM 'umbrella' later in its lifecycle? Where does OLE fit in? Is its (considerable) presence in MFC naming and MSDN in general - all just legacy? Wikipedia gives some insight, but not much. I couldn't find a more in depth reference. Ofek Shilon Found some quotes from COM Programming by Example : Another thing

How to properly call IDispatch::Invoke with a required BSTR* parameter

六眼飞鱼酱① 提交于 2019-12-02 02:49:30
问题 There are many examples of how to call IDispatch::Invoke with a BSTR* parameter. I have this working with many other "SomeType*" parameter but no matter what I try, I either get HRESULT of Type Mismatch, E_OUTOFMEMORY or an access violation. It seems to me I am doing something wrong with memory but I am following the different examples I have found... As a side note, the final "[out] UINT puArgErr" argument is never filled with the argument index that is causing the problem. However, I know

What are my options for C++ DLL to call a C# DLL?

柔情痞子 提交于 2019-12-01 11:10:27
I have a C++ DLL that needs to call a function (pass a value, return a value) in a C# class library. Is my only option to give the C# DLL a COM interface and call it from C++ with IDispatch? Is this the best method? Couple of options available for you here Use a mixed mode C++/CLI assembly as a bridge between the C++ and C# DLL Use the a COM bridge by exposing several of the key C# types as COM objects. This can then be accessed via the C++ code by normal COM semantics This project Creates dll exports for static methods in classes. You could then call a C# static method from unmanaged code.

How to get a IHTMLElement pointer to the <object> tag hosting an activex control

牧云@^-^@ 提交于 2019-12-01 05:34:35
问题 I have an ActiveX control generated by the FireBreath framework (http://firebreath.org). I need to get a reference to the <object> tag in the page that hosts the plugin from C++. If I were using NPAPI, I would use the NPNVPluginElementNPObject constant with NPN_GetValue. so to make sure I am being clear, say I have the following in the page: <object id="testPlugin" type="application/x-someplugin" width="100%" height="100%"></object> I want to get a reference to the plugin like I would if I

Does C# .NET support IDispatch late binding?

大憨熊 提交于 2019-11-28 06:48:51
The Question My question is: Does C# nativly support late-binding IDispatch? Pretend i'm trying to automate Office, while being compatible with whatever version the customer has installed. In the .NET world if you developed with Office 2000 installed, every developer, and every customer, from now until the end of time, is required to have Office 2000. In the world before .NET, we used COM to talk to Office applications. For example: 1) Use the version independant ProgID "Excel.Application" which resolves to: clsid = {00024500-0000-0000-C000-000000000046} and then using COM, we ask for one of

How to use IDispatch in plain C to call a COM object

泪湿孤枕 提交于 2019-11-28 04:35:24
I need to compile some code of mine using the gcc compiler included in the R tools (R the statistical program for windows), the problem is that I need to use IDispatch in my code to create an access the methods of a COM object, and the gcc compiler doesn't support much of the code that I'm using to do so, which is basically C++ code. So my question is how can I use IDispatch in C to create the COM object without having to depend on MFC, .NET, C#, WTL, or ATL. I believe that if I do so I will be able to compile my code without any problem. There is a great article on CodeProject entitled "COM

Does C# .NET support IDispatch late binding?

谁说胖子不能爱 提交于 2019-11-27 01:30:47
问题 The Question My question is: Does C# nativly support late-binding IDispatch? Pretend i'm trying to automate Office, while being compatible with whatever version the customer has installed. In the .NET world if you developed with Office 2000 installed, every developer, and every customer, from now until the end of time, is required to have Office 2000. In the world before .NET, we used COM to talk to Office applications. For example: 1) Use the version independant ProgID "Excel.Application"