我对数据库操作,如果在初始化数据库前调用 CFileDialog 实例就会出错,
不调用 CFileDialog 实例 就不会有错,请问这是怎么回事?
我数据库初始化是用:
AfxOleInit();
CString error;
m_pConnection.CreateInstance(__uuidof(Connection));
m_pRecordset.CreateInstance(__uuidof(Recordset));
进行的。
不调用 CFileDialog 实例 就不会有错,请问这是怎么回事?
我数据库初始化是用:
AfxOleInit();
CString error;
m_pConnection.CreateInstance(__uuidof(Connection));
m_pRecordset.CreateInstance(__uuidof(Recordset));
进行的。
TCHAR szName[MAX_PATH];
*szName = 0;
// Fill in standard structure fields
ofn.lStructSize = sizeof(OPENFILENAME);
ofn.hwndOwner = AfxGetMainWnd()->GetSafeHwnd();
ofn.lpstrFilter = "txt files\0*.txt\0All files\0*.*\0";
ofn.lpstrCustomFilter = NULL;
ofn.nFilterIndex = 1;
ofn.lpstrFile = szName;
ofn.nMaxFile = MAX_PATH;
ofn.lpstrTitle = TEXT("Open txt File...\0");
ofn.lpstrFileTitle = NULL;
ofn.lpstrDefExt = TEXT("*\0");
ofn.Flags = OFN_FILEMUSTEXIST | OFN_READONLY | OFN_PATHMUSTEXIST;
// Remember the path of the first selected file
// Create the standard file open dialog and return its result
GetOpenFileName((LPOPENFILENAME)&ofn);
strFileName.Format("%s",ofn.lpstrFile);