??????? 如何正确打开文件? ?????
我打开一个ini文件,读取数值来新建一个基于formView的子窗体,可是新建出来后我的文件总是被清空,请教各位:
BOOL CChildFrame::PreCreateWindow(CREATESTRUCT& cs)
{
// TODO: Modify the Window class or styles here by modifying
// the CREATESTRUCT cs
if( !CMDIChildWnd::PreCreateWindow(cs) )
return FALSE;
cs.x = 0;
cs.y = 0;
cs.style &= ~WS_MAXIMIZEBOX;
cs.style &= ~WS_MINIMIZEBOX;
cs.style &= ~WS_THICKFRAME;
cs.style &= ~WS_VSCROLL;
cs.style &= ~WS_HSCROLL;
//cs.style &= WS_CAPTION;
//cs.style &= ~WS_CAPTION;
//cs.style &= ~WS_POPUPWINDOW;
//Set CREATESTRUCT structure
BOOL bReturnValue = FALSE;
bool bIsOpenFile = ((CResEditorApp *)AfxGetApp())->b_IsOpenFile;
int m_width;
int m_height;
if (bIsOpenFile == false)
{
cs.cx = m_width;
cs.cy = m_height;
bReturnValue = TRUE;
}
else if(bIsOpenFile)
{
cs.cx = ((CResEditorApp *)AfxGetApp())->iCX;
cs.cy = ((CResEditorApp *)AfxGetApp())->iCY;
//return TRUE;
bReturnValue = TRUE;
}
return bReturnValue;
}
void CResEditorApp::OpenScreenFile(CString m_filePath)
{
b_IsOpenFile = true;
if(m_IniFile.OpenIniFileForRead(m_filePath))
{
}
m_IniFile.CloseIniFile();
CResEditorApp::OpenDocumentFile(m_filePath);
}
BOOL CIniFile::OpenIniFileForRead(CString s_filename)
{
BOOL bExist=IniFile.Open(s_filename, CFile::modeRead);
return bExist;
}
情多指教,谢谢