MFC and COM components
I never did this before under MFC C/C++. I added COM components to
the Toolbar
right click the ToolBox | Choose Items
and selected some Microsoft components, specifically the Microsoft
TabStrip component. It was added to the palette and now I can drop
the control into the dialog form. Then I right click the control and
"Add Variable" to create a m_tabs class member. When you do this, the
TLB information is used to a class wrapper for the dispatch commands.
In this case, it created, TabStrip2.h and TabStrips2.cpp.
What I want to get access to is the SelectedItem, which it has these
get/put functions to be used in property members:
LPDISPATCH get_SelectedItem()
{
LPDISPATCH result;
InvokeHelper(0xf, DISPATCH_PROPERTYGET, VT_DISPATCH, (void*)&result,
NULL);
return result;
}
void putref_SelectedItem(LPDISPATCH newValue)
{
static BYTE parms[] = VTS_DISPATCH ;
InvokeHelper(0xf, DISPATCH_PROPERTYPUTREF, VT_EMPTY, NULL, parms,
newValue);
}
void put_SelectedItem(VARIANT * newValue)
{
static BYTE parms[] = VTS_PVARIANT ;
InvokeHelper(0xf, DISPATCH_PROPERTYPUT, VT_EMPTY, NULL, parms,
newValue);
}
The question is how do use these in properties with LPDISPATCH?
For example, it is easier for a BOOL types such as get_ShowTips and
put_ShowTips:
BOOL get_ShowTips()
{
BOOL result;
InvokeHelper(0x3, DISPATCH_PROPERTYGET, VT_BOOL, (void*)&result, NULL);
return result;
}
void put_ShowTips(BOOL newValue)
{
static BYTE parms[] = VTS_BOOL ;
InvokeHelper(0x3, DISPATCH_PROPERTYPUT, VT_EMPTY, NULL, parms,
newValue);
}
By adding the following property to the TabStrip2.h class:
_declspec(property(get=get_ShowTips,put=put_ShowTips)) BOOL ShowTips;
I now can access this member in m_tabs:
m_tabs.ShowTips = FALSE;
What class or object is get_SelectedItem returning? I looked overall
google on this and there is no MFC C/C++ example with this.
I'm just explore it really, not sure if I will use it or not.
Thanks
--
HLS