BUG: COleControl::SetControlSize Function Does Not Work (270029)
The information in this article applies to:
- Microsoft Windows CE Toolkit for Visual C++ 6.0
- Microsoft eMbedded Visual C++, Version:4.0
This article was previously published under Q270029 SYMPTOMS
When you use the COleControl::SetControlSize function from within a Windows CE (WCE) Microsoft Foundation Classes (MFC) ActiveX ControlWizard generated ActiveX control, the ActiveX control does not resize properly.
RESOLUTION
To solve the problem, in addition to calling the COleControl::SetControlSize function, also call the SetWindowPos Win32 API function to resize the parent window of the control as shown in the following code example:
BOOL gfTest = FALSE;
void CMYCONTROLCtrl::OnLButtonDown(UINT nFlags, CPoint point)
{
if (gfTest) {
gfTest = FALSE;
((CWnd*)this)->GetParent()->SetWindowPos(NULL, 0, 0, 100, 100, SWP_NOZORDER | SWP_NOMOVE | SWP_NOACTIVATE);
SetControlSize(100, 100);
}
else {
gfTest = TRUE;
((CWnd*)this)->GetParent()->SetWindowPos(NULL, 0, 0, 200, 200, SWP_NOZORDER | SWP_NOMOVE | SWP_NOACTIVATE);
SetControlSize(200, 200);
}
COleControl::OnLButtonDown(nFlags, point);
}
STATUSMicrosoft has confirmed that this is a bug in the Microsoft products that are listed at the beginning of this article.
Modification Type: | Minor | Last Reviewed: | 8/19/2005 |
---|
Keywords: | kbbug kbCodeSnippet kbpending KB270029 |
---|
|