回调的问题
BOOL CALLBACK EnumChildProc(HWND hwnd,LPARAM lParam)
{
CRect rtCtrl,rtWnd;
if(hwnd)
{
::GetWindowRect(hwnd,&rtCtrl);
::GetWindowRect(GetParent(hwnd),&rtWnd);
rtCtrl.OffsetRect(-rtWnd.left-3,-rtWnd.top-29);
float temp;
temp= (float)rtCtrl.left*m_WidthScale;
rtCtrl.left = (int)temp;
temp= (float)rtCtrl.top*m_HeightScale;
rtCtrl.top = (int)temp;
temp = (float)rtCtrl.right*m_WidthScale;
rtCtrl.right = (int)temp;
temp =(float)rtCtrl.bottom*m_HeightScale;
rtCtrl.bottom = (int)temp;
::MoveWindow(hwnd,rtCtrl.left,rtCtrl.top,
rtCtrl.Width(),
rtCtrl.Height(),
TRUE);
return TRUE;
}
else
{
return FALSE;
}
}
void CTitleBarDlg::OnSize(UINT nType, int cx, int cy)
{
CDialog::OnSize(nType, cx, cy);
if(m_ReSizeFlag)
{
if(nType!=SIZE_MINIMIZED)
{
CRect rtWnd;
GetWindowRect(&rtWnd);
// new/Old
m_WidthScale = (float)rtWnd.Width()/(float)m_OldWidth;
m_HeightScale = (float)rtWnd.Height()/(float)m_OldHeight;
m_OldWidth = rtWnd.Width(); //保存新的Size;
m_OldHeight = rtWnd.Height();
HWND hWnd;
hWnd = GetSafeHwnd();
EnumChildWindows(hWnd,(WNDENUMPROC)EnumChildProc,0);
}
}
}
我对回调没什么概念,请大家指教
这是我正在看的程序,请问CALLBACK的原理是什么?
这两个函数的执行过程是怎样的?
谢谢!