Click here to Skip to main content
15,922,166 members
Home / Discussions / COM
   

COM

 
GeneralRe: Abnormally terminated client. Pin
Jörgen Sigvardsson16-Nov-04 9:53
Jörgen Sigvardsson16-Nov-04 9:53 
GeneralRe: Abnormally terminated client. Pin
Lim Bio Liong18-Nov-04 0:06
Lim Bio Liong18-Nov-04 0:06 
GeneralRe: Abnormally terminated client. Pin
Jörgen Sigvardsson18-Nov-04 0:10
Jörgen Sigvardsson18-Nov-04 0:10 
QuestionHow to estimate the CLSID of a manually loaded COM dll? Pin
karasu10-Nov-04 3:32
karasu10-Nov-04 3:32 
AnswerRe: How to estimate the CLSID of a manually loaded COM dll? Pin
vikramlinux15-Nov-04 0:20
vikramlinux15-Nov-04 0:20 
GeneralGet Parent folder from Full Qualified PIDL Pin
Marcus Spitzmiller9-Nov-04 8:18
Marcus Spitzmiller9-Nov-04 8:18 
GeneralCalling C++ COM with STL paramters from VB Pin
Member 15018497-Nov-04 18:17
Member 15018497-Nov-04 18:17 
GeneralRe: Calling C++ COM with STL paramters from VB Pin
Lim Bio Liong9-Nov-04 1:14
Lim Bio Liong9-Nov-04 1:14 
Hello PeKu,

All parameters of COM Object methods must be marshallable across
process and even machine boundaries. This is why when we define COM
interface method parameters (in an IDL file), we have to specify whether they are [in] or [out] parameters.

When we want to use our own user-defined structs as parameters, we must also
specify the attributes to the individual fields of these structs ([in],
[out] are amone these attributes). This is done in the IDL file of your
project.

These attributes help the MIDL compiler to produce marshalling code that will be used when the parameters of your COM methods are transported from one thread to another and from one process to another and even from one machine to another.

I will now attempt to answer your questions point by point. Please note that my answer is generic and will not apply to your VB client case. Take good note of this but I will address your VB client question later.

>> can we pass STL's ?
I believe that it is technically possible to define the marshalling
attributes of STL classes (e.g. vectors) but I doubt if it will be
simple. Remember that the most important thing about COM method parameters is that the MIDL compiler be able to produce the appropriate marshalling code for them.

>> can we pass by reference ?
If C++ referencing is what you mean, I don't think this is possible. But if you mean "pointer to pointer", yes, this is certainly possible (use the [in, out] attributes.

>> can we pass user defined objects ?
If your user-defined objects are in the form of structs, yes, but you need to define attributes for the individual fields of your struct.

If your user-defined objects are represented in the form of interface pointers, yes, this is certainly possible.


Let me now move on to your VB client case...

>> I intened to call this C++ COM from a cleint developed in VB.
In this case, the above points will not work. If your client is VB-based, then your COM objects MUST BE DUAL-INTERFACED. This means that the parameters to your COM methods MUST be one of a finite set of pre-defined types. These include long, int, BOOLEAN, and, of course the VARIANT. These types are also known as AUTOMATION-compatible types.

Take note, however, that the VARIANT type is a union that encompasses most of the popularly used types so you will usually be fine using it.


>> void test(std::vector
It will not be possible to define a parameter of this type. The only way to define an array type of parameter and to use it in relation to a VB client is to use the SAFEARRAY.

Hope the above helps, PeKu.

Regards,
Bio.




Generalcreating a com component from an IDL file Pin
vista274-Nov-04 11:49
vista274-Nov-04 11:49 
GeneralRe: creating a com component from an IDL file Pin
Christian Graus4-Nov-04 14:13
protectorChristian Graus4-Nov-04 14:13 
GeneralRe: creating a com component from an IDL file Pin
vista274-Nov-04 16:24
vista274-Nov-04 16:24 
GeneralRe: creating a com component from an IDL file Pin
Christian Graus4-Nov-04 17:18
protectorChristian Graus4-Nov-04 17:18 
GeneralRe: creating a com component from an IDL file Pin
vista274-Nov-04 17:26
vista274-Nov-04 17:26 
GeneralRe: creating a com component from an IDL file Pin
ThatsAlok4-Nov-04 18:30
ThatsAlok4-Nov-04 18:30 
GeneralRe: creating a com component from an IDL file Pin
vikramlinux5-Nov-04 0:23
vikramlinux5-Nov-04 0:23 
GeneralWMFormat SDK problem while read a .wmv Pin
ytod3-Nov-04 22:40
ytod3-Nov-04 22:40 
GeneralAbout Runtime and Developer Component Pin
ThatsAlok3-Nov-04 20:30
ThatsAlok3-Nov-04 20:30 
GeneralRe: About Runtime and Developer Component Pin
Sir Garence15-Nov-04 5:44
sussSir Garence15-Nov-04 5:44 
GeneralRe: About Runtime and Developer Component Pin
ThatsAlok15-Nov-04 17:31
ThatsAlok15-Nov-04 17:31 
GeneralCOM Component Returning An Array to VBScript Pin
Doug Knudson3-Nov-04 4:32
Doug Knudson3-Nov-04 4:32 
GeneralRe: COM Component Returning An Array to VBScript Pin
Vi25-Nov-04 3:19
Vi25-Nov-04 3:19 
GeneralOK. Component Services (COM+) crashes (?) Pin
CherezZaboro2-Nov-04 5:40
CherezZaboro2-Nov-04 5:40 
GeneralAccessing ActiveX control of other process Pin
Behlool1-Nov-04 19:00
Behlool1-Nov-04 19:00 
GeneralCoCreateInstance Failure Pin
skrishnasarma31-Oct-04 22:44
skrishnasarma31-Oct-04 22:44 
GeneralRe: CoCreateInstance Failure Pin
User 2155972-Nov-04 18:19
User 2155972-Nov-04 18:19 

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.