Solved

CFileDialog and OFN_SHAREAWARE => asserttion error

Posted on 1997-11-27
1
554 Views
Last Modified: 2013-11-20
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??
0
Comment
Question by:cost
1 Comment
 
LVL 23

Accepted Solution

by:
chensu earned 100 total points
ID: 1310963
You should use a bitwise-OR operator in your changes of m_ofn.Flags to keep the default behavior intact.

cfd.m_ofn.Flags |= OFN_SHAREAWARE;


0

Featured Post

How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

Join & Write a Comment

Suggested Solutions

Introduction: Hints for the grid button.  Nested classes, templated collections.  Squash that darned bug! Continuing from the sixth article about sudoku.   Open the project in visual studio. First we will finish with the SUD_SETVALUE messa…
Introduction: The undo support, implementing a stack. Continuing from the eigth article about sudoku.   We need a mechanism to keep track of the digits entered so as to implement an undo mechanism.  This should be a ‘Last In First Out’ collec…
This video will show you how to get GIT to work in Eclipse.   It will walk you through how to install the EGit plugin in eclipse and how to checkout an existing repository.
This video demonstrates how to create an example email signature rule for a department in a company using CodeTwo Exchange Rules. The signature will be inserted beneath users' latest emails in conversations and will be displayed in users' Sent Items…

760 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

22 Experts available now in Live!

Get 1:1 Help Now