BOOL CHexFileDialog::OnFileNameOK() { // Remember current window pos for when window is reopened CRect rr; GetParent()->GetWindowRect(&rr); theApp.WriteProfileInt("Window-Settings", strName+"X1", rr.left); theApp.WriteProfileInt("Window-Settings", strName+"Y1", rr.top); theApp.WriteProfileInt("Window-Settings", strName+"X2", rr.right); theApp.WriteProfileInt("Window-Settings", strName+"Y2", rr.bottom); // Remember current list view mode ASSERT(GetParent() != NULL); CWnd *psdv = FindWindowEx(GetParent()->m_hWnd, NULL, "SHELLDLL_DefView", NULL); ASSERT(psdv != NULL); CWnd *plv = FindWindowEx(psdv->m_hWnd, NULL, "SysListView32", NULL); ASSERT(plv != NULL); int mode = 0; switch (plv->SendMessage(LVM_FIRST + 143 /*LVM_GETVIEW*/)) { case LVS_ICON: case LVS_SMALLICON: mode = ICON; break; case LVS_REPORT: mode = REPORT; break; case LVS_LIST: mode = LIST; break; default: mode = TILE; break; } theApp.WriteProfileInt("Window-Settings", strName+"Mode", mode); return CFileDialog::OnFileNameOK(); }