Click here to Skip to main content
15,911,762 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralRe: dual interface Pin
George_George11-Sep-08 23:13
George_George11-Sep-08 23:13 
GeneralRe: dual interface Pin
CPallini11-Sep-08 23:45
mveCPallini11-Sep-08 23:45 
GeneralRe: dual interface Pin
George_George11-Sep-08 23:48
George_George11-Sep-08 23:48 
GeneralRe: dual interface Pin
CPallini12-Sep-08 0:44
mveCPallini12-Sep-08 0:44 
GeneralRe: dual interface Pin
George_George12-Sep-08 19:48
George_George12-Sep-08 19:48 
GeneralRe: dual interface Pin
Scott Holt12-Sep-08 14:38
Scott Holt12-Sep-08 14:38 
GeneralRe: dual interface Pin
George_George12-Sep-08 19:58
George_George12-Sep-08 19:58 
GeneralRe: dual interface Pin
Scott Holt13-Sep-08 1:25
Scott Holt13-Sep-08 1:25 
On point 1: I rarely implement dual interfaces because I develop COM servers and COM clients as part of a package application, and my client components always have "up front" knowledge of what the server can do. So, I typically do not implement the IDispatch interface. This results in a little less complexity in my application and improved performance.

My belief is that you should only implement IDispatch if a) you are developing a COM component that you are going to make publicly available to other developers so that they might use it in their applications, or b) your COM component needs to be used by a scripting language, for example VBScript within a web page, in which case you must implement IDispatch so that the VBScript can bind to your COM component at run time (late binding).

The application that I support is all written in C++ (no scripting languages) and contains no components that are intended to be available for use by other developers outside my company.

On point 2: You are correct, the client should always call "QueryInterface" to get a pointer to the desired interface exported by a server, then call the methods of that interface via the pointer. Since the methods of the interface are all defined as virtual functions in C++, you are implicitly invoking the methods through the virtual function table. (Of course, virtual functions are intrinsic to the C++ language and existed long before COM was created.)

Smile | :)
GeneralRe: dual interface Pin
George_George14-Sep-08 0:16
George_George14-Sep-08 0:16 
GeneralRe: dual interface Pin
Scott Holt16-Sep-08 9:24
Scott Holt16-Sep-08 9:24 
GeneralRe: dual interface Pin
George_George16-Sep-08 19:56
George_George16-Sep-08 19:56 
GeneralRe: dual interface Pin
Scott Holt18-Sep-08 2:24
Scott Holt18-Sep-08 2:24 
GeneralRe: dual interface Pin
George_George18-Sep-08 21:27
George_George18-Sep-08 21:27 
GeneralRe: dual interface Pin
Scott Holt22-Sep-08 2:25
Scott Holt22-Sep-08 2:25 
GeneralRe: dual interface Pin
George_George22-Sep-08 19:40
George_George22-Sep-08 19:40 
GeneralRe: dual interface Pin
Scott Holt24-Sep-08 0:40
Scott Holt24-Sep-08 0:40 
GeneralRe: dual interface Pin
George_George24-Sep-08 0:46
George_George24-Sep-08 0:46 
GeneralRe: dual interface Pin
Scott Holt25-Sep-08 0:13
Scott Holt25-Sep-08 0:13 
GeneralRe: dual interface Pin
George_George27-Sep-08 0:16
George_George27-Sep-08 0:16 
GeneralRe: dual interface Pin
George_George11-Sep-08 23:50
George_George11-Sep-08 23:50 
GeneralRe: dual interface Pin
CPallini12-Sep-08 0:56
mveCPallini12-Sep-08 0:56 
GeneralRe: dual interface Pin
George_George12-Sep-08 19:49
George_George12-Sep-08 19:49 
GeneralRe: dual interface Pin
George_George12-Sep-08 19:58
George_George12-Sep-08 19:58 
GeneralRe: dual interface Pin
CPallini12-Sep-08 21:44
mveCPallini12-Sep-08 21:44 
GeneralRe: dual interface Pin
George_George14-Sep-08 0:10
George_George14-Sep-08 0:10 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.