OPENFILENAME ofn;
TCHAR szPathName[MAX_PATH]; memset(&ofn, 0, sizeof ofn);
ofn.lStructSize = sizeof ofn;
ofn.Flags = OFN_HIDEREADONLY | OFN_OVERWRITEPROMPT;
ofn.hInstance = AfxGetInstanceHandle();
ofn.hwndOwner = GetSafeHwnd();
ofn.lpstrFilter = _T("Log files (*.log)\0*.log\0All files (*.*)\0*.*\0\0");
ofn.lpstrDefExt = _T("LOG");
szPathName[0] = 0;
ofn.nMaxFile = sizeof szPathName;
ofn.lpstrFile = szPathName;
if(GetOpenFileName(&ofn))
m_txtLogFile.SetWindowText(ofn.lpstrFile);