Click here to Skip to main content
15,913,055 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
QuestionHow to save the filename retrieved from a dialog class using CMFCEditBrowseCtrl? Pin
lolici10-Jul-17 8:07
lolici10-Jul-17 8:07 
Hello! I'm trying to browse a text file using CMFCEditBrowseCtrl (it is used in CFirstDialog Class) and use this file in another Dialog Class (named CSecondDialog Class). My problem is on how to save the filename retrieved from the CMFCEditBrowseCtrl when the CFirstDialog::OnEnChangeMfceditbrowse1() goes out of scope and then pass the filename to the CSecondDialog. Here is the code:

void CFirstDialog::OnEnChangeMfceditbrowse1()
{
        CString str;
	m_browser.GetWindowText(str); //CMFCEditBrowseCtrl m_browser (variable)
}


void CSecondDialog::OnBnClickedOk()
{
CStdioFile fileSource("here I need to put the filename retrieved from the previous dialog class", CFile::modeRead);
CStdioFile fileDest;
CString strLine;
CString strFile;
int num = 1;

while (fileSource.ReadString(strLine))
{
	strFile.Format(L"over%d.txt", num++);
	fileDest.Open(strFile, CFile::modeWrite);
	fileDest.WriteString(strLine);
	fileDest.Close();
}

fileSource.Close();

}

AnswerRe: How to save the filename retrieved from a dialog class using CMFCEditBrowseCtrl? Pin
Richard MacCutchan10-Jul-17 21:28
mveRichard MacCutchan10-Jul-17 21:28 
AnswerRe: How to save the filename retrieved from a dialog class using CMFCEditBrowseCtrl? Pin
Jochen Arndt10-Jul-17 21:38
professionalJochen Arndt10-Jul-17 21:38 
GeneralRe: How to save the filename retrieved from a dialog class using CMFCEditBrowseCtrl? Pin
lolici11-Jul-17 8:33
lolici11-Jul-17 8:33 
GeneralRe: How to save the filename retrieved from a dialog class using CMFCEditBrowseCtrl? Pin
Jochen Arndt11-Jul-17 9:08
professionalJochen Arndt11-Jul-17 9:08 
GeneralRe: How to save the filename retrieved from a dialog class using CMFCEditBrowseCtrl? Pin
lolici11-Jul-17 9:18
lolici11-Jul-17 9:18 
GeneralRe: How to save the filename retrieved from a dialog class using CMFCEditBrowseCtrl? Pin
lolici15-Jul-17 3:53
lolici15-Jul-17 3:53 
GeneralRe: How to save the filename retrieved from a dialog class using CMFCEditBrowseCtrl? Pin
Jochen Arndt15-Jul-17 22:00
professionalJochen Arndt15-Jul-17 22:00 
QuestionProblem in precedence of operators. Pin
parkavikkk7-Jul-17 21:25
parkavikkk7-Jul-17 21:25 
AnswerRe: Problem in precedence of operators. Pin
Richard MacCutchan7-Jul-17 22:02
mveRichard MacCutchan7-Jul-17 22:02 
GeneralRe: Problem in precedence of operators. Pin
parkavikkk7-Jul-17 22:30
parkavikkk7-Jul-17 22:30 
AnswerRe: Problem in precedence of operators. Pin
Jochen Arndt7-Jul-17 22:15
professionalJochen Arndt7-Jul-17 22:15 
AnswerRe: Problem in precedence of operators. Pin
Victor Nijegorodov8-Jul-17 11:13
Victor Nijegorodov8-Jul-17 11:13 
GeneralRe: Problem in precedence of operators. Pin
jschell10-Jul-17 4:33
jschell10-Jul-17 4:33 
Questionwhat is pla.h ? Pin
Flaze077-Jul-17 6:45
Flaze077-Jul-17 6:45 
AnswerRe: what is pla.h ? Pin
jeron17-Jul-17 7:20
jeron17-Jul-17 7:20 
AnswerRe: what is pla.h ? Pin
David Crow7-Jul-17 7:25
David Crow7-Jul-17 7:25 
GeneralRe: what is pla.h ? Pin
Flaze078-Jul-17 16:16
Flaze078-Jul-17 16:16 
Question(latest VS2017) Using the C++ Core Check (code analysis) trigger warning on corrected code. Pin
Maximilien6-Jul-17 5:56
Maximilien6-Jul-17 5:56 
AnswerRe: (latest VS2017) Using the C++ Core Check (code analysis) trigger warning on corrected code. Pin
Michael_Davies6-Jul-17 7:33
Michael_Davies6-Jul-17 7:33 
GeneralRe: (latest VS2017) Using the C++ Core Check (code analysis) trigger warning on corrected code. Pin
Maximilien7-Jul-17 5:30
Maximilien7-Jul-17 5:30 
GeneralRe: (latest VS2017) Using the C++ Core Check (code analysis) trigger warning on corrected code. Pin
Michael_Davies7-Jul-17 5:49
Michael_Davies7-Jul-17 5:49 
GeneralRe: (latest VS2017) Using the C++ Core Check (code analysis) trigger warning on corrected code. Pin
Richard Andrew x647-Jul-17 6:35
professionalRichard Andrew x647-Jul-17 6:35 
GeneralRe: (latest VS2017) Using the C++ Core Check (code analysis) trigger warning on corrected code. Pin
Michael_Davies7-Jul-17 8:27
Michael_Davies7-Jul-17 8:27 
QuestionAccess Driver in Embedded Standard OS Pin
divya036-Jul-17 0:48
divya036-Jul-17 0:48 

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.