用API建了个简单的属性对话框,可不论点"确定"还是"取消"按钮或是右上方的"X",都无法关闭它。我想通过在pfnDlgProc中处理PSN_KILLACTIVE来关闭它,可页面切换时也会产生此消息.....
怎么办啊?

解决方案 »

  1.   

    你拦截了WM_COMMAND没有? 拦截了WM_DESTROY了没有?
      

  2.   

    在哪拦截啊?对话框过程?每个页都有一个对话框过程....
    急啊,我甚至在codeguru上发了篇贴子,可能E文不好吧,人家看不懂,无人回复...
     create a Property Sheet ,with PSH_MODELESS |PSH_NOAPPLYNOW style. It has two pages . 
    Note pfnDlgProc :BOOL CALLBACK PageProc_0 (HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam) // PageProc_1 is similar
    {
    switch (uMsg) 
    {
    case WM_INITDIALOG:
    return TRUE;
    case WM_COMMAND:
    //...
    return TRUE; 
    case WM_NOTIFY:switch (((NMHDR FAR *) lParam)->code) 

    case PSN_SETACTIVE:
    {
    return TRUE ;
    }case PSN_KILLACTIVE:

    SetWindowLongPtr(hwnd,DWLP_MSGRESULT,FALSE);
    return TRUE ;
    }case PSN_APPLY:

    SetWindowLongPtr(hwnd,DWLP_MSGRESULT,PSNRET_NOERROR);
    return TRUE ;
    }case PSN_RESET:

    return TRUE ;
    }}//end switchbreak;
    }//end switch(uMsg) return (FALSE);
    }//end functionI clicks the OK or Cancel button ,or the "X" button, but the Property Sheet can't be closed ! The MSDN said "The OK and Apply buttons are similar ...The only difference is that clicking the OK button causes the property sheet to be destroyed after the changes are applied. "I have validate the changes by processing PSN_KILLACTIVE ( call the SetWindowLong function with the DWL_MSGRESULT value set to FALSE)
    and I call SetWindowLong with DWL_MSGRESULT set to PSNRET_NOERROR to indicate to the property sheet that the changes are valid for the page.Now ,why the Property Sheet not be closed ? How do I turn it off by clicks the OK or Cancel button ,or by clicks the "X" button ?
      

  3.   

    我原来加入了PSH_MODELESS类型,这就是关不掉属性对话框的原因 。