Click here to Skip to main content
15,907,910 members
Home / Discussions / COM
   

COM

 
Generalusing MSRdp control in windows application Pin
Behlool29-Apr-05 1:44
Behlool29-Apr-05 1:44 
GeneralPort Blocking for Windows 98! Pin
URagavSouth28-Apr-05 20:10
URagavSouth28-Apr-05 20:10 
GeneralOutlook CreateDispatch error - "No such interface supported" Pin
Nickmatic28-Apr-05 15:39
Nickmatic28-Apr-05 15:39 
GeneralPeculiar Exception Pin
Nirav Doshi28-Apr-05 6:32
Nirav Doshi28-Apr-05 6:32 
GeneralRe: Peculiar Exception Pin
User 21559728-Apr-05 23:32
User 21559728-Apr-05 23:32 
QuestionOLE VB Function equilivent for C++? Pin
BrianBoru28-Apr-05 4:42
BrianBoru28-Apr-05 4:42 
AnswerRe: OLE VB Function equilivent for C++? Pin
Vi212-May-05 1:42
Vi212-May-05 1:42 
GeneralThrowing an event with a nested UDT Pin
GizzoF28-Apr-05 0:18
GizzoF28-Apr-05 0:18 
Hi!
I'm trying to implement a event that fires an UDT which contains another UDT. I have some doubts and questions. Here is the idl code:

//------------------------------------------------------------------------<br />
typedef enum <br />
{<br />
	S1_item1 = 0,<br />
	// and more ...<br />
}enumSample1;<br />
<br />
//------------------------------------------------------------------------<br />
typedef enum <br />
{<br />
	s2_item1 = 100,<br />
	// and more ...<br />
}enumSample2;<br />
<br />
//------------------------------------------------------------------------<br />
typedef struct<br />
{<br />
	BSTR m_string1;<br />
	// and many more... all BSTRs<br />
<br />
	enumSample1 m_enum1;<br />
	enumSample2 m_enum2;<br />
}st_NestedUDT;<br />
<br />
//------------------------------------------------------------------------<br />
typedef enum<br />
{<br />
	s3_item1 = -1, //<-- Is this ok? <br />
	s3_item2 =  0,<br />
	// and more ...<br />
}enumSample_3;


Q1: Is the s3_item1 ok? I read somewhere that enums are finally unsigned short.

//------------------------------------------------------------------------<br />
typedef struct<br />
{<br />
	enumSample_3 m_eS;<br />
<br />
	// And here is where I want tht st_NestedUDT. <br />
	// st_NestedUDT m_stNested;<br />
	// VARIANT m_vntNested;<br />
}st_MainStruct


Q2: Should be the nested UDT member a VARIANT or just a st_NestedUDT member?

//------------------------------------------------------------------------
And the event is like:

[id(2), helpstring("method OnNewOrder")] HRESULT OnNewOrder(st_MainStruct stInfo);

And finally, how should I encapsulate the stInfo in order to call Invoke? My first thought was:

IRecordInfo * pRI;<br />
<br />
hr = GetRecordInfoFromGuids(LIBID_MyLibraryLib, 1, 0, 0, IID_st_Main_Struct, &pRI);<br />
if(FAILED(hr))<br />
	return hr;<br />
<br />
CComVariant avarParams[1];<br />
avarParams[0].vt = VT_RECORD;<br />
avarParams[0].pvRecord = stInfo;<br />
avarParams[0].pRecInfo = pRI;<br />
	<br />
CComVariant varResult;<br />
<br />
<br />
DISPPARAMS params = { avarParams, NULL, 1, 0 };<br />
hr = pConnection->Invoke(2, IID_NULL, LOCALE_USER_DEFAULT, DISPATCH_METHOD, ¶ms, &varResult, NULL, NULL);


Q3: Is that right?

Thank you in advance
Gizzo
GeneralProperties in COM Pin
ckapil27-Apr-05 23:12
ckapil27-Apr-05 23:12 
GeneralRe: Properties in COM Pin
ThatsAlok28-Apr-05 0:37
ThatsAlok28-Apr-05 0:37 
GeneralRe: Properties in COM Pin
ThatsAlok28-Apr-05 1:03
ThatsAlok28-Apr-05 1:03 
GeneralRe: Properties in COM Pin
ckapil28-Apr-05 1:24
ckapil28-Apr-05 1:24 
GeneralIStream object string length error Pin
mjharvey27-Apr-05 14:09
mjharvey27-Apr-05 14:09 
GeneralRe: IStream object string length error Pin
mjharvey27-Apr-05 16:45
mjharvey27-Apr-05 16:45 
GeneralMaking DLL from Matlab Pin
mosquets27-Apr-05 3:39
mosquets27-Apr-05 3:39 
GeneralComponent Accessibility Pin
Robert Findlay27-Apr-05 2:52
Robert Findlay27-Apr-05 2:52 
GeneralRe: Component Accessibility Pin
Robert Findlay9-May-05 1:07
Robert Findlay9-May-05 1:07 
GeneralNeed help about Office Automation Pin
figer25-Apr-05 21:47
figer25-Apr-05 21:47 
GeneralRe: Need help about Office Automation Pin
Jason Henderson26-Apr-05 8:16
Jason Henderson26-Apr-05 8:16 
GeneralRe: Need help about Office Automation Pin
vishalmore11-May-05 21:13
vishalmore11-May-05 21:13 
GeneralAcitveX container hanging problem Pin
kostik125-Apr-05 21:17
kostik125-Apr-05 21:17 
GeneralDCOM Pin
itkid25-Apr-05 19:32
itkid25-Apr-05 19:32 
GeneralRe: DCOM Pin
Mayur Mahajan26-Apr-05 17:21
Mayur Mahajan26-Apr-05 17:21 
GeneralHandling COM Events Pin
i.chen24-Apr-05 20:34
sussi.chen24-Apr-05 20:34 
GeneralRe: Handling COM Events Pin
Frank_lgh9-May-05 14:45
Frank_lgh9-May-05 14:45 

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.