-
ShellExecute Problem
Hi guys, I'm wondering if anyone can help me with a ShellExecute() problem.... I've alredy looked in a bunch of other Threads and still didn't got what I'm looking for....
Basicly, my program asks for a input and a output file, copys a bunch of stuff from the input file to the output file and opens the output file in Notepad.
The copy from the input file to the output file is working OK, but when I try to open the output file with ShellExecute, I get an empty file, although that if I try to open it trhu notepad i see the file is not empty......
Below the code I'm using
void CANSIDecoderDlg::OnSelectOutput()
{
CFileDialog m_ldFile(TRUE);
if (m_ldFile.DoModal() == IDOK)
{
m_Destination_File = m_ldFile.GetPathName();
UpdateData(FALSE);
}
}
void CANSIDecoderDlg::OnDecode()
{
.
.
.
if( (Buffer =fopen(m_Destination_File, "w" )) == NULL )
MessageBox("Destination File Not Found");
else
{
.
.
.
write a bunch of stuff in destination file
.
.
.
}
UpdateData(FALSE);
ShellExecute(NULL,
"open",
m_Destination_File,
NULL,
NULL,
SW_SHOWNORMAL);
}
:confused:
-
1. Please choose the windows forum when you post windows specific API questions
2. Please use code tags to ensure your code is nicely formatted
3. Did you close the file before trying to open it in notepad?
4. Does the extension (eg. .txt) match one of the ones notepad is bound to?
-
Yes.... I forgot to close the file..... sorry for that... and thanks a lot... it's incredible how simple mistakes make you loose so much time...
Once again.... thanks..