SetWindowPos Problem
-
I have positioned an ActiveX control onto a tabsheet control. I now want the ActiveX control to resize with the window. For some reason i don't get the desired result, can nayone see where i am slipping up. Thanks Richard Code Fragment: Init Dialog - Creation of the ActiveX Control m_tabSheet.GetWindowRect( &rc ); ScreenToClient( &rc ); rc.top += 30; rc.bottom -=90; rc.left += 5; rc.right -= 40; m_controlWrapper1.Create(m_hWnd,rc, _T("MSCAL.Calendar"), WS_CHILD, ....) Resize Event ============= RECT tabRC; m_tabSheet.GetClientRect(&tabRC); ScreenToClient( &tabRC ); tabRC.top += 30; tabRC.bottom -=90; tabRC.left += 5; tabRC.right -= 40; m_controlWrapper1.SetWindowPos(CWnd::wndTop, tabRC.left, tabRC.top,tabRC.right - tabRC.left, tabRC.bottom - tabRC.top,SWP_SHOWWINDOW);
-
I have positioned an ActiveX control onto a tabsheet control. I now want the ActiveX control to resize with the window. For some reason i don't get the desired result, can nayone see where i am slipping up. Thanks Richard Code Fragment: Init Dialog - Creation of the ActiveX Control m_tabSheet.GetWindowRect( &rc ); ScreenToClient( &rc ); rc.top += 30; rc.bottom -=90; rc.left += 5; rc.right -= 40; m_controlWrapper1.Create(m_hWnd,rc, _T("MSCAL.Calendar"), WS_CHILD, ....) Resize Event ============= RECT tabRC; m_tabSheet.GetClientRect(&tabRC); ScreenToClient( &tabRC ); tabRC.top += 30; tabRC.bottom -=90; tabRC.left += 5; tabRC.right -= 40; m_controlWrapper1.SetWindowPos(CWnd::wndTop, tabRC.left, tabRC.top,tabRC.right - tabRC.left, tabRC.bottom - tabRC.top,SWP_SHOWWINDOW);
One thing is that I think you'd better use the MoveWindow function instead of the SetWindowPos function in that case. Have you checked the the coordinate don't reach something like a bottom higher than a top... Computers have enabled people to make more mistakes faster than almost any invention in history, with the possible exception of tequila and hand guns. - Carl Gundlach