Just set 'lpstrTitle' to your own specified string.
void CSampleDlg::OnButton1()
{
OPENFILENAME ofn = {0};
char szName[MAX_PATH];
*szName = 0;
ofn.lStructSize = sizeof(OPENFILENAME);
ofn.hwndOwner = AfxGetApp()->m_pMainWnd->m_hWnd;
ofn.lpstrFilter = NULL;
ofn.lpstrFilter = "Text files (*.txt)\0*.txt\0All files (*.*)\0*.*\0";
ofn.lpstrCustomFilter = NULL;
ofn.nFilterIndex = 1;
ofn.lpstrFile = &szName[0];
ofn.nMaxFile = MAX_PATH;
ofn.lpstrInitialDir = NULL;
ofn.lpstrTitle = "This is My Title to replace the default title";
ofn.lpstrFileTitle = NULL;
ofn.lpstrDefExt = "TXT";
ofn.Flags = OFN_FILEMUSTEXIST | OFN_HIDEREADONLY | OFN_PATHMUSTEXIST | OFN_EXPLORER;
if (GetOpenFileName(&ofn)){
CString SelectedFile = ofn.lpstrFile;
// Do something with file
}
}