Link to home
Start Free TrialLog in
Avatar of cost
cost

asked on

CFileDialog and OFN_SHAREAWARE => asserttion error

Hi,

I want to use the CFileDialog so that a user can choose a file. The file will not be opened now, but rather stored in my inifile. The problem is that I can get a share violation when choosing the file, so I found OFN_SHAREAWARE, which I thought should ignore the error and just return the filename, which is exactly what I want, but when doing DoModal() I get assertion error in MS code.

My code:

CFileDialog cfd( true, "tok\0", initialFilename );
cfd.m_ofn.Flags = OFN_SHAREAWARE;
      
if( cfd.DoModal() == IDOK )
{
   m_filename = cfd.GetPathName( );
   UpdateData( false );
}

How can I solve this one??
ASKER CERTIFIED SOLUTION
Avatar of chensu
chensu
Flag of Canada image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial