SWITCH循环中分支返回1 或 0 或BREACK;有什么异同?BOOL CALLBACK AboutDlgProc (HWND hDlg, UINT message,WPARAM wParam, LPARAM lParam)
        
{
        
           switch (message)
        
           {
        
           case   WM_INITDIALOG :
        
                  return TRUE ;
        
        
        
           case   WM_COMMAND :
        
                  switch (LOWORD (wParam))
        
                  {
        
                  case   IDOK :
        
                  case   IDCANCEL :
        
                                         EndDialog (hDlg, 0) ;
        
                                         return TRUE ;
        
         }
        
                  break ;
        
    }
        
  return FALSE ;
        
}
这个函数为什么返回假?

解决方案 »

  1.   

    return的话,函数直接返回了,不再往下执行 
    break根据情况退出当前的结构,继续往下执行 
    按照你的代码,break之后,执行return false 
    return都是return true true和false的意义就在于窗口处理函数的说明,见msdn 
    Typically, the dialog box procedure should return TRUE if it processed the message, and FALSE if it did not. If the dialog box procedure returns FALSE, the dialog manager performs the default dialog operation in response to the message. 意思就是说,如果你返回false就调用默认的窗口处理函数 
    如果你reture true表示你自己处理了,不再调用默认的窗口处理函数 
    因为windows程序要运行起来,需要处理的消息很多,让coder一个一个处理太麻烦,因此提供了默认的处理函数