Click here to Skip to main content
15,924,318 members
Home / Discussions / COM
   

COM

 
GeneralRe: BSTR Pin
Lim Bio Liong13-Jun-05 23:44
Lim Bio Liong13-Jun-05 23:44 
GeneralRe: BSTR Pin
Get.Well14-Jun-05 1:57
Get.Well14-Jun-05 1:57 
GeneralLooking for Excel ver.9 type library (and how to make it work!) Pin
minette9-Jun-05 3:58
minette9-Jun-05 3:58 
GeneralCopy data to spread sheet component from excel file Pin
Member 20313358-Jun-05 22:34
Member 20313358-Jun-05 22:34 
GeneralCapturing ActiveX events Pin
Haroon8-Jun-05 19:51
Haroon8-Jun-05 19:51 
GeneralSending User Defined Types over COM Interface Pin
ChemmieBro8-Jun-05 4:53
ChemmieBro8-Jun-05 4:53 
GeneralRe: Sending User Defined Types over COM Interface Pin
Andy Moore8-Jun-05 11:06
Andy Moore8-Jun-05 11:06 
GeneralRe: Sending User Defined Types over COM Interface Pin
Lim Bio Liong14-Jun-05 1:16
Lim Bio Liong14-Jun-05 1:16 
Hello ChemmieBro,

You basically have to define your structs as User-Defined Types (UDT) in your IDL file. Listed below are examples of My_Struct and Image_Struct defined as UDTs :

typedef
[
uuid(C1B33DAB-A011-41ca-83E0-A7F5AEB01E52),
version(1.0),
helpstring("Image_Struct")
]
struct Image_Struct // Image_Struct definition
{
[helpstring("X pixel position.")] float pixel_x;
[helpstring("Y pixel position.")] float pixel_y;
[helpstring("Z pixel position.")] float pixel_z;
} Image_Struct;


typedef
[
uuid(AC11F3A5-855D-495d-B9CF-17EBA35ACC79),
version(1.0),
helpstring("My_Struct")
]
struct My_Struct // Example Struct
{
[helpstring("index.")] int index1;
[helpstring("The Image_Struct struct.")] Image_Struct* Image_List;
} My_Struct;

It is important that the UDT has got a GUID defined for it. This is defined in the "typedef" attribute for the struct.

Also important is that all your fields -should- be (but not necessarily) automation-compatible types. Only so will your UDT be usable in VB.

After this is done, define your interface and methods normally. Include My_Struct and/or Image_Struct types as parameters as per normal.

Listed below is an example interface that refers to My_Struct :

[
object,
uuid(8F75662A-3CC4-42D1-8F2F-0C98E42594A6),
dual,
helpstring("IImageStructProcessor Interface"),
pointer_default(unique)
]
interface IImageStructProcessor : IDispatch
{
[id(1), helpstring("method ProcessMyStruct")] HRESULT ProcessMyStruct([in, out] My_Struct* pMyStruct);
[id(2), helpstring("method FreeMyStructContents")] HRESULT FreeMyStructContents([in] My_Struct* pMyStruct);
};

I have created some working example codes based on My_Struct, Image_Struct and the IImageStructProcessor interface.

Send an email to me if you want a copy of the example codes. My email address is :

bio_lim_2004@yahoo.com


Best Regards,
Bio.

GeneralRe: Sending User Defined Types over COM Interface Pin
Logan from Singapore26-Jun-05 23:05
Logan from Singapore26-Jun-05 23:05 
GeneralRe: Sending User Defined Types over COM Interface Pin
Lim Bio Liong27-Jun-05 0:26
Lim Bio Liong27-Jun-05 0:26 
GeneralCreate GUID from string Pin
Kri58-Jun-05 4:17
Kri58-Jun-05 4:17 
GeneralRe: Create GUID from string Pin
Anonymous9-Jun-05 1:00
Anonymous9-Jun-05 1:00 
GeneralGet Control ID from ActiveX button Pin
MailtoGops6-Jun-05 5:52
MailtoGops6-Jun-05 5:52 
GeneralRe: Get Control ID from ActiveX button Pin
Veera Raghavendra17-Jun-05 19:08
Veera Raghavendra17-Jun-05 19:08 
GeneralRe: Get Control ID from ActiveX button Pin
MailtoGops22-Aug-05 0:25
MailtoGops22-Aug-05 0:25 
GeneralDistributed Transaction Error Pin
janlala5-Jun-05 0:10
janlala5-Jun-05 0:10 
QuestionIDispacth, ADORecordset and properties loss?!? Pin
almc3-Jun-05 0:53
almc3-Jun-05 0:53 
General Acessing ActiveX Component Interfaces/ Library not registered Pin
Florian Storck1-Jun-05 23:13
Florian Storck1-Jun-05 23:13 
GeneralRe: Acessing ActiveX Component Interfaces/ Library not registered Pin
lemur21-Jun-05 23:25
lemur21-Jun-05 23:25 
GeneralRe: Acessing ActiveX Component Interfaces/ Library not registered Pin
Florian Storck1-Jun-05 23:34
Florian Storck1-Jun-05 23:34 
GeneralRe: Acessing ActiveX Component Interfaces/ Library not registered Pin
Florian Storck2-Jun-05 0:12
Florian Storck2-Jun-05 0:12 
GeneralRe: Acessing ActiveX Component Interfaces/ Library not registered Pin
lemur22-Jun-05 21:58
lemur22-Jun-05 21:58 
GeneralRe: Acessing ActiveX Component Interfaces/ Library not registered Pin
Florian Storck2-Jun-05 23:34
Florian Storck2-Jun-05 23:34 
GeneralRe: Acessing ActiveX Component Interfaces/ Library not registered Pin
Jörgen Sigvardsson17-Jun-05 22:06
Jörgen Sigvardsson17-Jun-05 22:06 
GeneralRe: Acessing ActiveX Component Interfaces/ Library not registered Pin
Florian Storck19-Jun-05 21:03
Florian Storck19-Jun-05 21:03 

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.