Write Access Error When Using CFileDialog
void myClass::OnBnClickedBrowseOutput()
{
UpdateData(TRUE);
CFileDialog openDlg( TRUE, _T("*.*"), NULL, OFN_HIDEREADONLY, NULL);
if( openDlg.DoModal() == IDOK )
{
output = openDlg.GetPathName();
UpdateData(FALSE);
}
}
The code above is how I open a CFileDialog in order to grab the path
name. The problem I am having is that when execute my code and click
on the browse button, it seems to work fine. I close my application
and rebuild it, and when I rebuild it, it tells me this:
LINK : fatal error LNK1168: cannot open ../../../bin/myfile.exe for
writing
It does this everytime. In order for me to fix the problem, I have to
go to the project properties and change the output directory so that it
will allow me rebuild. The reason that it cannot open the file for
writing is because the file is still in use, even though the
application is not in use. I ran task manager to check to see if there
are instances of it, and there isn't.
So, I thikn that the problem is that I am using CFileDialog. I am
thinking that maybe the resources cannot be freed and thats why I can't
rebuild my application?
thanks