Click here to Skip to main content
15,891,529 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
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 
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 
Yes, on point number 1...You ONLY have to support IDispatch if you want scripting languages or other languages that use late binding to be able to use to your COM server component. Of course, this is very often the case these days with so many COM components being written to plug into web sites and be called from VB script, Java script, etc. I'm sorry I should have made this more clear. So, you CAN have a COM component publicly available that does NOT support IDispatch, but it will need to be linked with the client program at compile (build) time.

On point 2: YES, all parameter/return values MUST be automation compatible. Basically, this means that everything must be VARIANT, BSTR, long integer, etc. Why? Because COM is a defined standard that all programming languages that wish to be COM compliant must adhere to if they wish to interface with each other, and IDispatch is a defined interface within the standard. If you wish to use much of the automation linkage already put into place by Microsoft, and the COM subsystem (also implemented by Microsoft via Windows), you'll have to adhere to the standards of the subsystem components. For example, of you try to pass a "C-style" string from a C++ program to a VB program through a COM interface, the VB program will probably crash because it doesn't "understand" the structure of a C-style string.

Incidentally, I had to read two or three books on COM and diligently work the examples before I got it figured out. I tried using ATL and the Visual Studio wizards to create my COM components, but quickly gave up on this because it was very inflexible when I wanted to make additions or changes to my COM classes. I ended up hand-building, from scratch, all of my COM components, but now I have a library of components for use in my applications.

Scott
Smile | :)
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 
GeneralRe: dual interface Pin
CPallini12-Sep-08 21:53
mveCPallini12-Sep-08 21:53 
GeneralRe: dual interface Pin
George_George14-Sep-08 0:12
George_George14-Sep-08 0:12 

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.