Reputation: 83
Just as the title stated. How do I open a text in notepad in MFC?
I used the CFileDialog
to open up a "Save As" dialog box like so :
TCHAR szFilters[] =
_T ("Text files (*.txt)¦*.txt¦All files (*.*)¦*.*¦¦");
CFileDialog dlg (FALSE, _T ("txt"), _T ("*.txt"),
OFN_OVERWRITEPROMPT, szFilters);
if (dlg.DoModal () == IDOK)
m_strPathName = dlg.GetPathName();
After I have the path name in m_strPathName
, is there anyway to directly open up the txt file that had been saved in a Notepad?
I have another button OnShowData
and this is the code inside.
ShellExecute(NULL, _T("open"), m_strPathName, NULL, NULL, SW_SHOW);
Is there any other method that I could do this??
PROBLEM SOLVED
Upvotes: -1
Views: 1628
Reputation: 107
The following API can also be used for the same
WinExec("C:\MyFolder", ...)
Upvotes: 0