Solved

CFileDialog and OFN_SHAREAWARE => asserttion error

Posted on 1997-11-27
1
577 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
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

Free Tool: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Introduction: Load and Save to file, Document-View interaction inside the SDI. Continuing from the second article about sudoku.   Open the project in visual studio. From the class view select CSudokuDoc and double click to open the header …
In this post we will learn different types of Android Layout and some basics of an Android App.
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.
In this brief tutorial Pawel from AdRem Software explains how you can quickly find out which services are running on your network, or what are the IP addresses of servers responsible for each service. Software used is freeware NetCrunch Tools (https…

623 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