Click here to Skip to main content
15,914,444 members
Home / Discussions / COM
   

COM

 
GeneralRe: Get windowmessages to a com object Pin
NormDroid2-Oct-01 1:20
professionalNormDroid2-Oct-01 1:20 
GeneralRe: Get windowmessages to a com object Pin
Christer2-Oct-01 1:23
Christer2-Oct-01 1:23 
GeneralImporting TLB Problem Pin
Joseph Dempsey1-Oct-01 5:59
Joseph Dempsey1-Oct-01 5:59 
GeneralRe: Importing TLB Problem Pin
Rashid Thadha9-Oct-01 2:43
Rashid Thadha9-Oct-01 2:43 
GeneralTypes, types, types Pin
1-Oct-01 2:52
suss1-Oct-01 2:52 
GeneralRe: Types, types, types Pin
Aaron Schaefer1-Oct-01 4:45
Aaron Schaefer1-Oct-01 4:45 
GeneralRe: Types, types, types Pin
1-Oct-01 5:13
suss1-Oct-01 5:13 
GeneralRe: Types, types, types Pin
Aaron Schaefer1-Oct-01 6:14
Aaron Schaefer1-Oct-01 6:14 
Well, properties are actually function calls in dispatch interfaces. Variables would be things like the symbolic constants of an enum declaration. It's a little bit messy, but once you've got the ITypeInfo for an interface, you can iterate through the functions of the interface like this:

// First off, get the type attributes
TYPEATTR* pTypeAttr = NULL;
FUNCDESC* pFuncDesc = NULL;
pTypeInfo->GetTypeAttr(&pTypeAttr); // Should be dispatch

// Now you can iterate the functions in the interface
for(int j=0; j < pTypeAttr->cFuncs; j++)
{
pTypeInfo->GetFuncDesc(j, &pFuncDesc);
printf("\ncParams = %i", pFuncDesc->cParams);
printf("\ncParamsOpt = %i", pFuncDesc->cParamsOpt);

// The type of function invokation
switch(pFuncDesc->invkind)
{
// A "normal" function
case INVOKE_FUNC: printf("\ninvkind = INVOKE_FUNC"); break;

// A property
case INVOKE_PROPERTYGET: printf("\ninvkind = INVOKE_PROPERTYGET"); break;
case INVOKE_PROPERTYPUT: printf("\ninvkind = INVOKE_PROPERTYPUT"); break;
case INVOKE_PROPERTYPUTREF: printf("\ninvkind = INVOKE_PROPERTYPUTREF"); break;
}

// The return type of the function
switch(pFuncDesc->elemdescFunc.tdesc.vt)
{
case VT_EMPTY: printf("\nelemdescFunc.tdesc.vt = VT_EMPTY // Not specified."); break;
case VT_NULL: printf("\nelemdescFunc.tdesc.vt = VT_NULL // SQL-style Null."); break;
case VT_I2: printf("\nelemdescFunc.tdesc.vt = VT_I2 // 2-byte signed int."); break;
case VT_I4: printf("\nelemdescFunc.tdesc.vt = VT_I4 // 4-byte-signed int."); break;
case VT_R4: printf("\nelemdescFunc.tdesc.vt = VT_R4 // 4-byte real."); break;
case VT_R8: printf("\nelemdescFunc.tdesc.vt = VT_R8 // 8-byte real."); break;
<etc...>
}

// Parameter types of a function
// Parameter type of a function
k = 0;
while(k < pFuncDesc->cParams)
{
vt = (VARENUM)pFuncDesc->lprgelemdescParam[k].tdesc.vt;
k++;
}


pTypeInfo->ReleaseFuncDesc(pFuncDesc);

}
pTypeInfo->ReleaseTypeAttr(pTypeAttr);


The "return type" will be the type of the property in question. The FUNCDESC will contain a memid, use this to identify the function/property in question as it is defined in the interface. More than one function may map to a given memid, for instance, a propertyput and a propertyget would map to a single property on an interface, bu will nevertheless show up twice when iterating the functions through the ITypeInfo interface. If all you want is the type of each property, you could create a map<long, varenum=""> and fill it up while traversing the functions of the interface. Then, later:

long memid;
VARENUM vt = return_types[memid];

Or something similar. Unfortunately, the type info mechanism doesn't give you a way to get info for a given member id, so you have to iterate through all of them for a given interface and make your own map. The array FUNCDESC::lprgelemdescParam should have the parameter types accepted by the function.
GeneralRe: Types, types, types Pin
1-Oct-01 6:57
suss1-Oct-01 6:57 
QuestionCan I use GDI+ lib in my ATL projects Pin
joyle29-Sep-01 19:26
joyle29-Sep-01 19:26 
Questionhow to set IE default homepage and error pages in VC? Pin
Amit Dey29-Sep-01 12:49
Amit Dey29-Sep-01 12:49 
AnswerRe: how to set IE default homepage and error pages in VC? Pin
Amit Dey3-Oct-01 0:31
Amit Dey3-Oct-01 0:31 
GeneralActiveX for Internet Explorer and versioning Pin
29-Sep-01 0:56
suss29-Sep-01 0:56 
QuestionHow to create an ActiveX in a CView (MFC) help or URL or Books wanted Pin
Remi Morin27-Sep-01 4:46
Remi Morin27-Sep-01 4:46 
AnswerRe: How to create an ActiveX in a CView (MFC) help or URL or Books wanted Pin
Remi Morin28-Sep-01 3:42
Remi Morin28-Sep-01 3:42 
GeneralThe interface contract Pin
Andrew McGrath27-Sep-01 2:00
Andrew McGrath27-Sep-01 2:00 
GeneralRe: The interface contract Pin
Not Active27-Sep-01 6:35
mentorNot Active27-Sep-01 6:35 
GeneralRe: The interface contract Pin
In-At23-Oct-01 20:35
In-At23-Oct-01 20:35 
GeneralRe: The interface contract Pin
Andrew McGrath23-Oct-01 21:09
Andrew McGrath23-Oct-01 21:09 
GeneralRe: The interface contract Pin
In-At23-Oct-01 23:59
In-At23-Oct-01 23:59 
Questionhow to pass USER_LOGON variable to ActiveX developed in VC++? Pin
Bartek27-Sep-01 0:26
Bartek27-Sep-01 0:26 
QuestionThe initial size in the resurce editor? Pin
George26-Sep-01 21:19
George26-Sep-01 21:19 
Questionhow to transfer Interface Pointer? Pin
maya26-Sep-01 16:05
maya26-Sep-01 16:05 
GeneralNewbie, please help Pin
Rob Brown26-Sep-01 9:25
Rob Brown26-Sep-01 9:25 
GeneralRe: Newbie, please help Pin
Daniel Turini29-Sep-01 3:30
Daniel Turini29-Sep-01 3:30 

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.