Print Page | Close Window

CFile::Open flags in LoadFromFile

Printed From: Codejock Forums
Category: Codejock Products
Forum Name: Skin Framework
Forum Description: Topics Related to Codejock Skin Framework
URL: http://forum.codejock.com/forum_posts.asp?TID=15248
Printed Date: 28 June 2022 at 2:32pm
Software Version: Web Wiz Forums 12.04 - http://www.webwizforums.com


Topic: CFile::Open flags in LoadFromFile
Posted By: VitVal
Subject: CFile::Open flags in LoadFromFile
Date Posted: 25 September 2009 at 7:24pm
The CXTPGraphicBitmapPng::LoadFromFile has such code:
/---
 CFile file;
 if (!file.Open(lpszFileName, CFile::modeRead))
 {
  return FALSE;
 }
---/
The code can result in failing to load an image if two instanses of a program will try to open the file.
I think you should change flags for CFile::Open
/---
  CFile file;
  if (! file.Open(lpszFileName, CFile::modeRead | CFile::shareDenyWrite))
 {
  return FALSE;
 }
---/



Print Page | Close Window

Forum Software by Web Wiz Forums® version 12.04 - http://www.webwizforums.com
Copyright ©2001-2021 Web Wiz Ltd. - https://www.webwiz.net