static int OnDeleteFileClick(HWND hDlg)
{
    TFileTestData * pData = GetDialogData(hDlg);
    int nError = ERROR_SUCCESS;

    // Save the dialog variables
    SaveDialog(hDlg);

    // Choose what exactly to do
    switch(FileActionDialog(hDlg))
    {
        case IDC_SIMPLE_DELETE:
            if(!DeleteFile(pData->szFileName1))
                nError = GetLastError();
            break;

        case IDC_FORCED_DELETE:
            nError = ForceRemoveFile(pData->szFileName1);
            break;

        default:
            return TRUE;
    }

    UpdateDialogButtons(hDlg);
    SetResultInfo(hDlg, nError);
    return TRUE;
}
    void DialogClientView::ViewHierarchyChanged(bool is_add, View* parent,
        View* child)
    {
        if(is_add && child==this)
        {
            // Can only add and update the dialog buttons _after_ they are added to the
            // view hierarchy since they are native controls and require the
            // Container's HWND.
            ShowDialogButtons();
            ClientView::ViewHierarchyChanged(is_add, parent, child);

            UpdateFocusListener();

            // The "extra view" must be created and installed after the contents view
            // has been inserted into the view hierarchy.
            CreateExtraView();
            UpdateDialogButtons();
            Layout();
        }
    }
static int OnSetActive(HWND hDlg)
{
    TFileTestData * pData = GetDialogData(hDlg);

    if((pData->dwCreateOptions & FILE_OPEN_BY_FILE_ID) == 0)
    {
        SetDlgItemText(hDlg, IDC_FILE_NAME1, pData->szFileName1);
        ConvertToWin32Name(hDlg, IDC_FILE_NAME1);
    }
    else
    {
        pData->szDirName[0] = 0;
        pData->dwCreateOptions &= ~FILE_OPEN_BY_FILE_ID;
    }

    if(pData->szFileName2[0] != 0)
    {
        SetDlgItemText(hDlg, IDC_FILE_NAME2, pData->szFileName2);
        ConvertToWin32Name(hDlg, IDC_FILE_NAME2);
    }

    UpdateDialogButtons(hDlg);
    return TRUE;
}
static int OnKillActive(HWND hDlg)
{
    SaveDialog(hDlg);
    UpdateDialogButtons(hDlg);
    return TRUE;
}