R
ryotyankou via OfficeKB.com
My environment is VC++2005/ATL/OLK2003&2007. I added Outlook::
ApplicationEvents successfully and all are ok. But the size of propertypage
for outlook2003 and 2007 is different, so i want to adjust the controls'
position to the middle of the propertypage. But it is no use to call
SetWindowPos or MoveWindow in OnInitDialog function, what should i do? I have
a lot of controls on the propertypage.
LRESULT CPropPage::OnInitDialog(UINT uMsg, WPARAM wParam, LPARAM lParam,
BOOL& bHandled)
{
// TODO : Add Code for message handler. Call DefWindowProc if necessary.
GetDlgItem(IDC_STATIC_PROPAGE).SetFont(HFONT(boldFont_));
SetTimer(FreshGUI, 1000, NULL);
//set the window position, can't take effort, why??
m_Control = GetParent();
CRect ParentRc, CurRc;
int xCord = 0, yCord = 0;
m_Control.GetClientRect(ParentRc);
GetWindowRect(CurRc);
xCord = (ParentRc.Width()-CurRc.Width())/2;
yCord = (ParentRc.Height()-CurRc.Height())/2;
SetWindowPos(HWND_TOP, xCord, yCord, 0, 0, SWP_NOSIZE|SWP_SHOWWINDOW);
return 0;
}
ApplicationEvents successfully and all are ok. But the size of propertypage
for outlook2003 and 2007 is different, so i want to adjust the controls'
position to the middle of the propertypage. But it is no use to call
SetWindowPos or MoveWindow in OnInitDialog function, what should i do? I have
a lot of controls on the propertypage.
LRESULT CPropPage::OnInitDialog(UINT uMsg, WPARAM wParam, LPARAM lParam,
BOOL& bHandled)
{
// TODO : Add Code for message handler. Call DefWindowProc if necessary.
GetDlgItem(IDC_STATIC_PROPAGE).SetFont(HFONT(boldFont_));
SetTimer(FreshGUI, 1000, NULL);
//set the window position, can't take effort, why??
m_Control = GetParent();
CRect ParentRc, CurRc;
int xCord = 0, yCord = 0;
m_Control.GetClientRect(ParentRc);
GetWindowRect(CurRc);
xCord = (ParentRc.Width()-CurRc.Width())/2;
yCord = (ParentRc.Height()-CurRc.Height())/2;
SetWindowPos(HWND_TOP, xCord, yCord, 0, 0, SWP_NOSIZE|SWP_SHOWWINDOW);
return 0;
}