我在工程中使用才class wizard加入了一个property sheet控件(wizard类型),如何把它自动生成的help按钮从弹出的对话框中拿掉。

解决方案 »

  1.   

    Help Button
    Property sheets can display two Help buttons: a property sheet Help button that is displayed at the bottom of the frame, next to the OK/Cancel/Apply buttons, and a standard caption bar button that provides context-sensitive Help.The property sheet Help button is optional, and can be enabled on a page by page basis. To display the property sheet Help button for one or more pages:Set the PSH_HASHELP flag in the dwFlags member of the property sheet's PROPSHEETHEADER structure. 
    For each page that will display a Help button, set the PSP_HASHELP flag in the dwFlags member of the page's PROPSHEETPAGE structure. 
    When the user clicks the Help button, the active page receives a PSN_HELP notification message. The page must respond by displaying Help information, typically by calling the WinHelp function.Removing the Caption Bar Help Button
    The caption bar Help button is displayed by default, so that context-sensitive Help is always available for the OK/Cancel/Apply buttons. However, this button can be removed, if necessary. To remove a property sheet's caption bar Help button:For versions of the common controls prior to version 5.80, you must implement a property sheet callback function. 
    For version 5.80 and later of the common controls, you can simply set the PSH_NOCONTEXTHELP flag in the dwFlags member of the property sheet's PROPSHEETHEADER structure. However, if you need backward compatibility with earlier common control versions, you must implement the callback function. 
    To implement a property sheet callback function that removes the caption bar Help button: 
    Set the PSH_USECALLBACK flag in the dwFlags member of the property sheet's PROPSHEETHEADER structure. 
    Set the pfnCallBack member of the PROPSHEETHEADER structure to point to the callback function. 
    Implement the callback function. When this function receives the PSCB_PRECREATE message, it will also receive a pointer to the property sheet's dialog box template. Remove the DS_CONTEXTHELP style from this template. 
    The following sample illustrates how to implement such a callback function:int CALLBACK RemoveContextHelpProc(HWND hwnd, UINT message, LPARAM lParam)
    {
        switch (message) {
        case PSCB_PRECREATE:
            // Remove the DS_CONTEXTHELP style from the dialog box template
            if (((LPDLGTEMPLATEEX)lParam)->signature ==  0xFFFF){
                ((LPDLGTEMPLATEEX)lParam)->style &= ~DS_CONTEXTHELP;
            }
            else {
                ((LPDLGTEMPLATE)lParam)->style &= ~DS_CONTEXTHELP;
            }
            return TRUE;
        }
        return TRUE;
    }If the DLGTEMPLATEEX structure is not defined, include the following declaration:#include <pshpack1.h>
    typedef struct DLGTEMPLATEEX
    {
        WORD dlgVer;
        WORD signature;
        DWORD helpID;
        DWORD exStyle;
        DWORD style;
        WORD cDlgItems;
        short x;
        short y;
        short cx;
        short cy;
    } DLGTEMPLATEEX, *LPDLGTEMPLATEEX;
    #include <poppack.h>
      

  2.   

    // Since CPropertySheet() always adds new pages to the end of 
             // its propertypage list, we have to remove all pages starting 
             // at index 1 (original location for the second page).  Then, 
             // add them back one at a time.
             for (int i = 1; i < count; i++)
                sheet->RemovePage(i);
             
             for (i = 1; i < arr_size; i++)
                sheet->AddPage(m_PropPageArray[i]);
      

  3.   

    找到答案。。BOOL CMyPropertySheet::OnInitDialog() 
    {
    BOOL bResult = CPropertySheet::OnInitDialog();

    // TODO: Add your specialized code here
    CWnd* pWnd = GetDlgItem(IDHELP);
    ASSERT(pWnd);
    if(pWnd)pWnd->ShowWindow(FALSE); return bResult;
    }