在对话框 程序中
对 WM_PAINT消息的处理函数void CTestWaitForSingleDlg::OnPaint() 
{
if (IsIconic())
{
CPaintDC dc(this); // device context for painting SendMessage(WM_ICONERASEBKGND, (WPARAM) dc.GetSafeHdc(), 0); // Center icon in client rectangle
int cxIcon = GetSystemMetrics(SM_CXICON);
int cyIcon = GetSystemMetrics(SM_CYICON);
CRect rect;
GetClientRect(&rect);
int x = (rect.Width() - cxIcon + 1) / 2;
int y = (rect.Height() - cyIcon + 1) / 2; // Draw the icon
dc.DrawIcon(x, y, m_hIcon);
}
else
{
CDialog::OnPaint();
}
}这个函数中if (IsIconic())
{
CPaintDC dc(this); // device context for painting SendMessage(WM_ICONERASEBKGND, (WPARAM) dc.GetSafeHdc(), 0); // Center icon in client rectangle
int cxIcon = GetSystemMetrics(SM_CXICON);
int cyIcon = GetSystemMetrics(SM_CYICON);
CRect rect;
GetClientRect(&rect);
int x = (rect.Width() - cxIcon + 1) / 2;
int y = (rect.Height() - cyIcon + 1) / 2; // Draw the icon
dc.DrawIcon(x, y, m_hIcon);
}是干什么用的??
我在里面设置了断点, 怎么也执行不到阿

解决方案 »

  1.   

    if (IsIconic())
    指窗口最小化的时候做的事情
      

  2.   

    我 在
    if (IsIconic())
     {
       AfxMessageBox("Test");
      .........然后把程序 最小化 可是没有执行AfxMessageBox("Test");
      

  3.   

    怪事。我本来是写客户区中 yang 的,但是说“请不要发表可能给我们带来伤害的言论,谢谢配合”。
      

  4.   

    好像是为了兼容NT3.51而设置的代码?忘了哪儿看到的,也许是Jeff Prosise <programming with MFC>
      

  5.   

    On Windows versions prior to Windows 95 and Windows NT 4.0, the WM_ICONERASEBKGND message is sent to a minimized window when the background of the icon must be filled before painting the icon. A window receives this message only if a class icon is defined for the window; otherwise, WM_ERASEBKGND is sent. 
    This message is not sent by newer versions of Windows.我明白了