T
Tom at GSD
Hello,
I have designed a custom ATL control as part of a command bar for Outlook
2003. The custom control integrates fantastically with the command bar and
the control displays fine with only one small problem. I want the control to
have a fixed width and height. It seems no matter what I do the command bar
will cause the width to vary when the user resizes outlook. I want the
control to have a fixed size such as 85x22. The resizing also seems to not
have any affect on the size of the command bar because it remains fixed; but
other controls are pushed out of view while increasing the size of the
outlook window. I have added logic to the control to keep the size the same
but it and I have added the following code to the command bar.
CComVariant vEmpty(DISP_E_PARAMNOTFOUND, VT_ERROR);
CComVariant vShow(VARIANT_TRUE);
CComVariant vCControlType(msoControlActiveX);
CComPtr<Office::CommandBarControl> spCCtrl;
spCCtrl;= spCommandBarCtrls->Add(vCControlType, vEmpty, vEmpty, vEmpty,
vShow);
ATLASSERTspCCtrl;
m_spCustom = spCCtrl;
HRESULT h =
m_spCustom->put_ControlCLSID(L"{9BF33C91-EEFA-4CEE-984F-0EFDBB3B6666}");
m_spCustom->put_Visible(VARIANT_TRUE);
m_spCustom->put_Enabled(VARIANT_TRUE);
CComPtr<IDispatch> spDisp;
m_spCustom->get_QueryControlInterface(L"{00020400-0000-0000-C000-000000000046}", (IUnknown**)&spDisp);
m_spMyCustControl = spDisp;
m_spCustom->put_Width(85);
m_spCustom->put_Height(22);
I also have added logic to the control after reading some info on the web to
the WM_SIZE message. The code seems to control the actual internal control
but not the container.
Has anybody run into the problem before? Is there a way to fix the size of a
custom control?
Thanks,
Tom -
I have designed a custom ATL control as part of a command bar for Outlook
2003. The custom control integrates fantastically with the command bar and
the control displays fine with only one small problem. I want the control to
have a fixed width and height. It seems no matter what I do the command bar
will cause the width to vary when the user resizes outlook. I want the
control to have a fixed size such as 85x22. The resizing also seems to not
have any affect on the size of the command bar because it remains fixed; but
other controls are pushed out of view while increasing the size of the
outlook window. I have added logic to the control to keep the size the same
but it and I have added the following code to the command bar.
CComVariant vEmpty(DISP_E_PARAMNOTFOUND, VT_ERROR);
CComVariant vShow(VARIANT_TRUE);
CComVariant vCControlType(msoControlActiveX);
CComPtr<Office::CommandBarControl> spCCtrl;
spCCtrl;= spCommandBarCtrls->Add(vCControlType, vEmpty, vEmpty, vEmpty,
vShow);
ATLASSERTspCCtrl;
m_spCustom = spCCtrl;
HRESULT h =
m_spCustom->put_ControlCLSID(L"{9BF33C91-EEFA-4CEE-984F-0EFDBB3B6666}");
m_spCustom->put_Visible(VARIANT_TRUE);
m_spCustom->put_Enabled(VARIANT_TRUE);
CComPtr<IDispatch> spDisp;
m_spCustom->get_QueryControlInterface(L"{00020400-0000-0000-C000-000000000046}", (IUnknown**)&spDisp);
m_spMyCustControl = spDisp;
m_spCustom->put_Width(85);
m_spCustom->put_Height(22);
I also have added logic to the control after reading some info on the web to
the WM_SIZE message. The code seems to control the actual internal control
but not the container.
Has anybody run into the problem before? Is there a way to fix the size of a
custom control?
Thanks,
Tom -