Questions tagged [idispatch]

The IDispatch interface exposes objects, methods and properties to programming tools and other applications that support Automation.

IDispatch Interface

Exposes objects, methods and properties to programming tools and other applications that support Automation. COM components implement the IDispatch interface to enable access by Automation clients, such as Visual Basic.

The IDispatch interface was initially designed to support Automation. It provides a late-binding mechanism to access and retrieve information about an object's methods and properties. Previously, server developers had to implement both the IDispatch and IAccessible interfaces for their accessible objects; that is, they had to provide a dual interface. With Microsoft Active Accessibility 2.0, servers can return E_NOTIMPL from IDispatch methods and Microsoft Active Accessibility will implement the IAccessible interface for them.

http://msdn.microsoft.com/en-us/library/windows/desktop/ms221608(v=vs.85).aspx

120 questions
4
votes
1 answer

Callback from C# COM dll to Delphi app causes memory leak

I have a COM server written in C#, and a COM client written in Delphi. I've implemented a call-back mechanism that is simple and elegant and it works like a charm. However, FastMM4 reports that my Delphi client is creating a memory leak. I've…
Thomas Bates
  • 197
  • 9
4
votes
2 answers

C# COM object with a dynamic interface

I'd like to build a COM visible C# class, say DynamicComponent, that would provide a dynamic interface through COM. Internally this class would maintain a dictionary of delegates: "GetTheAnswer" -> () => { return 42; } "Add" -> (int a, int b) => {…
Pragmateek
  • 13,174
  • 9
  • 74
  • 108
4
votes
1 answer

What is interactions of correlations for two interfaces with same GUID

I used to think that type safety in Delphi with regard to Interfaces is maintained by setting a unique (optional, but unique if filled in) GUID to it. Then there came that question: Unspecified error when calling Word CentimetersToPoints via…
Arioch 'The
  • 15,799
  • 35
  • 62
3
votes
1 answer

Access violation casting IDispatch in XE2

We're using some old code (ComLib.pas created by Binh Ly) so we can use the enumeration interface on an (OleVariant) object: type TDispNewEnum = dispinterface ['{97079E31-6957-11D2-9154-0000B4552A26}'] // dummy property _NewEnum: IUnknown…
Mick
  • 846
  • 2
  • 7
  • 18
3
votes
1 answer

Invoke call on released COM object

I create a COM object used for automation tasks of some application. When this happens application is started and its' main window is displayed. The problem happens when user closes the main application window. Next Invoke call to the COM object…
bombardier
  • 905
  • 3
  • 9
  • 19
3
votes
1 answer

Why are all references to my IDispatch object not released?

I'm hosting an IWebBrowser2 control in my C++ program using nothing but plain Win32 (no mfc, atl, wtl etc). On DISPID_NAVIGATECOMPLETE2 I add a custom object to be accessed from javascript running on the displayed webpage. To add the custom object I…
Tobbe
  • 3,282
  • 6
  • 41
  • 53
3
votes
1 answer

IDispatch Invoke() returns Type mismatch

I'm unable to successfully invoke create_session member. It's return Type mismatch // COM class -> member virtual HRESULT __stdcall create_session( /*[in]*/ BSTR pbszName, /*[in]*/ long i32Value ) = 0; Trying to invoke…
Rajib Chy
  • 800
  • 10
  • 22
3
votes
3 answers

Registration Free (Regfree) COM

We are using a COM Object automation model to make our application available to our customers. They are using for the most part python to access our applicaton interface. As we want to be able to install (not yet run, that's another issue) different…
PsiX
  • 1,661
  • 1
  • 17
  • 35
3
votes
1 answer

How to create anonymous IDispatch functions with ATL?

Is there an easy way to create a class that is derived from IDispatch and that can be passed to API like this (this is C++ ): pDOM2->attachEvent(CComBSTR("event"), new DispatchFunction); I know how to create a C++ object that handle an invoke with…
Emmanuel Caradec
  • 2,302
  • 1
  • 19
  • 38
3
votes
2 answers

List of IDispatch errors and/or message texts

I am calling methods on WMI/WBEM interfaces that return HRESULTS. I want to display meaningful error messages for these error codes to the user. However, when I look up the HRESULT's error message I only get strings like "IDispatch error…
Helge Klein
  • 8,829
  • 8
  • 51
  • 71
3
votes
4 answers

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

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…
Ian Boyd
  • 246,734
  • 253
  • 869
  • 1,219
3
votes
2 answers

Hook IDispatch v-table in C++

I'm trying to modify the behavior of an IDispatch interface already present in the system. To do this my plan was to hook into the objects v-table during runtime and modify the pointers so it points to a custom hook method instead. If I can get this…
monoceres
  • 4,722
  • 4
  • 38
  • 63
3
votes
2 answers

Class Interface's uuid and DispID are changed when migrating from Visual Studio 2010 to 2012

We have developed a .NET Assembly named XXadapter. The goal is to have XXadapter act as a COM object to unmanaged clients. XXadapter class implements a C++ COM IDL-defined interface. The C++ COM object was added as a reference to the C# project,…
Chloe
  • 41
  • 6
3
votes
0 answers

c# marshaling IDispatch pointer

In an Unmanaged IDispatch interface my code calls, one of the functions is [id(1), helpstring("method")] HRESULT Test(IDispatch* pDispatch, [out, retval] long* pRC); To call this I'm trying: Object myObj = …
probably at the beach
  • 14,489
  • 16
  • 75
  • 116
2
votes
4 answers

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

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?
Jason
  • 16,739
  • 23
  • 87
  • 137