Expiring Today—Celebrate National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

CFileDialog and OFN_SHAREAWARE => asserttion error

Posted on 1997-11-27
1
Medium Priority
?
585 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 300 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

Moving data to the cloud? Find out if you’re ready

Before moving to the cloud, it is important to carefully define your db needs, plan for the migration & understand prod. environment. This wp explains how to define what you need from a cloud provider, plan for the migration & what putting a cloud solution into practice entails.

Question has a verified solution.

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

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…
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 video, Percona Solution Engineer Rick Golba discuss how (and why) you implement high availability in a database environment. To discuss how Percona Consulting can help with your design and architecture needs for your database and infrastr…

719 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