Solved

CFileDialog and OFN_SHAREAWARE => asserttion error

Posted on 1997-11-27
1
557 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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
Windows Drag & Drop Location 2 94
Named range not carried over 10 62
sumDigits challenge 9 122
fizzArray  challenge 1 58
Introduction: Dynamic window placements and drawing on a form, simple usage of windows registry as a storage place for information. Continuing from the first article about sudoku.  There we have designed the application and put a lot of user int…
Introduction: Ownerdraw of the grid button.  A singleton class implentation and usage. Continuing from the fifth article about sudoku.   Open the project in visual studio. Go to the class view – CGridButton should be visible as a class.  R…
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.
Delivering innovative fully-managed cloud services for mission-critical applications requires expertise in multiple areas plus vision and commitment. Meet a few of the people behind the quality services of Concerto.

911 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

21 Experts available now in Live!

Get 1:1 Help Now