Click here to Skip to main content
15,884,353 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
QuestionHow to embedded CFileDialog to user dialog? Pin
includeh1030-Jun-11 5:41
includeh1030-Jun-11 5:41 
AnswerRe: How to embedded CFileDialog to user dialog? Pin
Richard MacCutchan30-Jun-11 6:20
mveRichard MacCutchan30-Jun-11 6:20 
AnswerRe: How to embedded CFileDialog to user dialog? Pin
Mark Salsbery30-Jun-11 8:15
Mark Salsbery30-Jun-11 8:15 
AnswerRe: How to embedded CFileDialog to user dialog? Pin
Albert Holguin30-Jun-11 9:06
professionalAlbert Holguin30-Jun-11 9:06 
AnswerRe: How to embedded CFileDialog to user dialog? Pin
Philippe Mori1-Jul-11 10:07
Philippe Mori1-Jul-11 10:07 
QuestionConvert string to alpha numeric value Pin
Cpp_Com30-Jun-11 3:14
Cpp_Com30-Jun-11 3:14 
AnswerRe: Convert string to alpha numeric value Pin
Chris Losinger30-Jun-11 4:12
professionalChris Losinger30-Jun-11 4:12 
QuestionCFile file handle problem Pin
TheHelenLee29-Jun-11 23:51
TheHelenLee29-Jun-11 23:51 
Hi All,

Sorry for the lengthy description, I don't know how else to explain it...

I have a program which has a sqlite database backup function.

It opens the source.db file, writes backup version info and date into a backup.db file, appends those info with binary stream of source.db, and then closes both files.

However, my program fails with a sharing violation when it tries to open the source.db

CFile csf;
		
CFileException e;
			
if (!csf.Open(_T("source.db", CFile::modeNoTruncate | CFile::typeBinary | CFile::modeRead, &e ))
{
     if (e.m_cause == CFileException::sharingViolation )
	AfxMessageBox(_T("Sharing Violation!!"));
}


I traced the program to filecore.cpp, looked like my program cannot obtain a file handle at this line:

HANDLE hFile = m_pTM != NULL ? 
	m_pTM->CreateFile(lpszFileName, dwAccess, dwShareMode, &sa, dwCreateFlag, dwFlags, NULL) :
		::CreateFile(lpszFileName, dwAccess, dwShareMode, &sa, dwCreateFlag, dwFlags, NULL);


Even though the source.db is in use, I should still be able to have read access to it, right?

Another observation that puzzles me is that the backup function works on another .db file created by the same program.

I've been searching on the web and tried everything I can. Would someone please give me some suggestion?

Thanks,

Helen
AnswerRe: CFile file handle problem Pin
Chris Meech30-Jun-11 6:21
Chris Meech30-Jun-11 6:21 
GeneralRe: CFile file handle problem Pin
TheHelenLee30-Jun-11 17:26
TheHelenLee30-Jun-11 17:26 
QuestionHelp and Guidance for Access Database. Pin
Le@rner29-Jun-11 22:50
Le@rner29-Jun-11 22:50 
AnswerRe: Help and Guidance for Access Database. Pin
Richard MacCutchan29-Jun-11 23:32
mveRichard MacCutchan29-Jun-11 23:32 
GeneralRe: Help and Guidance for Access Database. Pin
Le@rner29-Jun-11 23:51
Le@rner29-Jun-11 23:51 
GeneralRe: Help and Guidance for Access Database. Pin
Richard MacCutchan30-Jun-11 0:03
mveRichard MacCutchan30-Jun-11 0:03 
GeneralRe: Help and Guidance for Access Database. [modified] Pin
Le@rner30-Jun-11 0:52
Le@rner30-Jun-11 0:52 
GeneralRe: Help and Guidance for Access Database. Pin
David Crow30-Jun-11 8:15
David Crow30-Jun-11 8:15 
QuestionHow can and what type of dll is created by MFC to use in any language? Pin
Le@rner29-Jun-11 21:41
Le@rner29-Jun-11 21:41 
AnswerRe: How can and what type of dll is created by MFC to use in any language? Pin
Richard MacCutchan29-Jun-11 23:30
mveRichard MacCutchan29-Jun-11 23:30 
GeneralRe: How can and what type of dll is created by MFC to use in any language? Pin
Le@rner30-Jun-11 2:40
Le@rner30-Jun-11 2:40 
GeneralRe: How can and what type of dll is created by MFC to use in any language? Pin
Richard MacCutchan30-Jun-11 3:40
mveRichard MacCutchan30-Jun-11 3:40 
GeneralRe: How can and what type of dll is created by MFC to use in any language? Pin
Albert Holguin30-Jun-11 4:26
professionalAlbert Holguin30-Jun-11 4:26 
GeneralRe: How can and what type of dll is created by MFC to use in any language? Pin
Richard MacCutchan30-Jun-11 5:57
mveRichard MacCutchan30-Jun-11 5:57 
QuestionCEdit Control property in a SDI- Split Window [modified] Pin
AneeshValeri29-Jun-11 18:23
AneeshValeri29-Jun-11 18:23 
AnswerRe: CEdit Control property in a SDI- Split Window Pin
AneeshValeri29-Jun-11 19:00
AneeshValeri29-Jun-11 19:00 
QuestionWhat is the unique in any PC? Pin
Le@rner29-Jun-11 1:21
Le@rner29-Jun-11 1:21 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.