Click here to Skip to main content
15,911,039 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralRe: CFtpConnection ???? Pin
David Crow4-Aug-06 2:31
David Crow4-Aug-06 2:31 
GeneralRe: CFtpConnection ???? Pin
racing574-Aug-06 3:15
racing574-Aug-06 3:15 
GeneralRe: CFtpConnection ???? Pin
racing574-Aug-06 3:22
racing574-Aug-06 3:22 
GeneralRe: CFtpConnection ???? Pin
racing5715-Aug-06 4:14
racing5715-Aug-06 4:14 
QuestionWriting different language into VC6 Pin
Stan the man3-Aug-06 5:20
Stan the man3-Aug-06 5:20 
AnswerRe: Writing different language into VC6 Pin
Ștefan-Mihai MOGA3-Aug-06 14:00
professionalȘtefan-Mihai MOGA3-Aug-06 14:00 
QuestionKeeping an MDI file locked with CFile::shareExclusive Pin
bob169723-Aug-06 4:50
bob169723-Aug-06 4:50 
AnswerRe: Keeping an MDI file locked with CFile::shareExclusive Pin
Viorel.3-Aug-06 5:13
Viorel.3-Aug-06 5:13 
I think you should try a different way. Define a member of CFile type inside your document class, and then override OnOpenDocument, OnSaveDocument, and OnCloseDocument functions. In these functions call the original ones, but also add your code for locking and unlocking the file using additional CFile member (or maybe with some other features).

I suppose the functions may look like this:

BOOL CMyDocument::OnOpenDocument(LPCTSTR lpszPathName)
{
	if( ! CDocument::OnOpenDocument(lpszPathName)) return FALSE;
	m_MyFile.Open(lpszPathName, CFile::shareExclusive);
	return TRUE;
}

void CMyDocument::OnCloseDocument()
{
	m_MyFile.Close();
	CDocument::OnCloseDocument();
}

BOOL CMyDocument::OnSaveDocument(LPCTSTR lpszPathName)
{
	m_MyFile.Close();
	if( ! CDocument::OnSaveDocument(lpszPathName)) return FALSE;
	m_MyFile.Open(lpszPathName, CFile::shareExclusive);
}


I hope it works.
GeneralRe: Keeping an MDI file locked with CFile::shareExclusive Pin
bob169723-Aug-06 5:47
bob169723-Aug-06 5:47 
Questionneed good idea of print-preview Pin
includeh103-Aug-06 4:42
includeh103-Aug-06 4:42 
AnswerRe: need good idea of print-preview Pin
bob169723-Aug-06 4:59
bob169723-Aug-06 4:59 
GeneralRe: need good idea of print-preview Pin
includeh103-Aug-06 8:14
includeh103-Aug-06 8:14 
AnswerRe: need good idea of print-preview Pin
Hamid_RT4-Aug-06 7:02
Hamid_RT4-Aug-06 7:02 
QuestionWinsock - Multicasting with CCESocket [modified] Pin
king minger3-Aug-06 4:27
king minger3-Aug-06 4:27 
NewsRe: Winsock - Multicasting with CCESocket [modified] Pin
king minger3-Aug-06 5:08
king minger3-Aug-06 5:08 
AnswerRe: Winsock - Multicasting with CCESocket Pin
king minger4-Aug-06 1:26
king minger4-Aug-06 1:26 
QuestionDeclaring Array Variable for a Class [modified] Pin
Andy Rama3-Aug-06 4:16
Andy Rama3-Aug-06 4:16 
AnswerRe: Declaring Array Variable for a Class Pin
David Crow3-Aug-06 4:22
David Crow3-Aug-06 4:22 
GeneralRe: Declaring Array Variable for a Class Pin
Andy Rama3-Aug-06 8:43
Andy Rama3-Aug-06 8:43 
QuestionRe: Declaring Array Variable for a Class Pin
David Crow4-Aug-06 2:32
David Crow4-Aug-06 2:32 
QuestionRe: Declaring Array Variable for a Class Pin
Andy Rama4-Aug-06 2:51
Andy Rama4-Aug-06 2:51 
AnswerRe: Declaring Array Variable for a Class Pin
David Crow4-Aug-06 2:59
David Crow4-Aug-06 2:59 
AnswerRe: Declaring Array Variable for a Class Pin
Zac Howland3-Aug-06 5:01
Zac Howland3-Aug-06 5:01 
GeneralRe: Declaring Array Variable for a Class Pin
Andy Rama3-Aug-06 19:31
Andy Rama3-Aug-06 19:31 
GeneralRe: Declaring Array Variable for a Class Pin
Zac Howland4-Aug-06 3:18
Zac Howland4-Aug-06 3:18 

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.