Click here to Skip to main content
16,004,806 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralRe: Can VC++ launch MS Dos window then issues Dos commands? Pin
ATC12-Dec-06 15:55
ATC12-Dec-06 15:55 
GeneralRe: Can VC++ launch MS Dos window then issues Dos commands? Pin
Sam Hobbs12-Dec-06 16:29
Sam Hobbs12-Dec-06 16:29 
GeneralRe: Can VC++ launch MS Dos window then issues Dos commands? Pin
Stephen Hewitt12-Dec-06 17:00
Stephen Hewitt12-Dec-06 17:00 
GeneralRe: Can VC++ launch MS Dos window then issues Dos commands? Pin
Sam Hobbs12-Dec-06 19:26
Sam Hobbs12-Dec-06 19:26 
GeneralRe: Can VC++ launch MS Dos window then issues Dos commands? Pin
Stephen Hewitt12-Dec-06 19:32
Stephen Hewitt12-Dec-06 19:32 
GeneralRe: Can VC++ launch MS Dos window then issues Dos commands? Pin
Sam Hobbs12-Dec-06 20:29
Sam Hobbs12-Dec-06 20:29 
GeneralRe: Can VC++ launch MS Dos window then issues Dos commands? Pin
Stephen Hewitt13-Dec-06 10:05
Stephen Hewitt13-Dec-06 10:05 
QuestionMultiple application instances-how prevent multiple file instances or file overwrite Pin
lctrncs12-Dec-06 10:41
lctrncs12-Dec-06 10:41 
I am a rank amateur fighting scope creep and finalizing (one can always hope!) a general educational program in MFC/C++ Document/View after years of "bang your head on the wall" programming. It is good to allow multiple instances of the program, and extensive testing using multiple instances has uncovered only one apparent issue - the ability of multiple instances of the program to open and edit the same file. When switching with Alt-Tab between two instances of the program with the same file open, it is possible to overwrite the file from either instance, resulting in the ability to lose work by overwriting with an earlier version.

How can I use a semaphore (or anything else) to prevent the user from opening a file that is already open, or at least give the user a warning on file open or save? I am having trouble understanding how to use the semaphore (or anything else) to lock the file when I open it or test to see if it is locked when I try to open it again because there just do not seem to be many examples out there due to the apparently prevalent desire to prevent multiple instances of an application.



Thanks in advance for your time and consideration.




"For a successful technology, reality must take precedence over public relations, for nature cannot be fooled." Richard Feynman, Minority Report to the Official Report on the Space Shuttle Challenger Crash

AnswerRe: Multiple application instances-how prevent multiple file instances or file overwrite Pin
Mark Salsbery12-Dec-06 11:29
Mark Salsbery12-Dec-06 11:29 
GeneralRe: Multiple application instances-how prevent multiple file instances or file overwrite Pin
lctrncs13-Dec-06 7:48
lctrncs13-Dec-06 7:48 
GeneralRe: Multiple application instances-how prevent multiple file instances or file overwrite Pin
Mark Salsbery13-Dec-06 8:27
Mark Salsbery13-Dec-06 8:27 
GeneralRe: Multiple application instances-how prevent multiple file instances or file overwrite Pin
lctrncs14-Dec-06 10:57
lctrncs14-Dec-06 10:57 
GeneralRe: Multiple application instances-how prevent multiple file instances or file overwrite Pin
lctrncs14-Dec-06 11:00
lctrncs14-Dec-06 11:00 
GeneralRe: Multiple application instances-how prevent multiple file instances or file overwrite Pin
Mark Salsbery14-Dec-06 11:34
Mark Salsbery14-Dec-06 11:34 
GeneralRe: Multiple application instances-how prevent multiple file instances or file overwrite Pin
lctrncs14-Dec-06 13:06
lctrncs14-Dec-06 13:06 
GeneralRe: Multiple application instances-how prevent multiple file instances or file overwrite Pin
Mark Salsbery14-Dec-06 13:36
Mark Salsbery14-Dec-06 13:36 
GeneralRe: Multiple application instances-how prevent multiple file instances or file overwrite Pin
lctrncs14-Dec-06 14:18
lctrncs14-Dec-06 14:18 
GeneralRe: Multiple application instances-how prevent multiple file instances or file overwrite Pin
Mark Salsbery14-Dec-06 16:12
Mark Salsbery14-Dec-06 16:12 
GeneralRe: Multiple application instances-how prevent multiple file instances or file overwrite Pin
lctrncs15-Dec-06 8:05
lctrncs15-Dec-06 8:05 
GeneralRe: Multiple application instances-how prevent multiple file instances or file overwrite Pin
Mark Salsbery15-Dec-06 8:50
Mark Salsbery15-Dec-06 8:50 
GeneralRe: Multiple application instances-how prevent multiple file instances or file overwrite Pin
lctrncs18-Dec-06 6:01
lctrncs18-Dec-06 6:01 
GeneralRe: Multiple application instances-how prevent multiple file instances or file overwrite Pin
Mark Salsbery18-Dec-06 7:39
Mark Salsbery18-Dec-06 7:39 
GeneralRe: Multiple application instances-how prevent multiple file instances or file overwrite Pin
lctrncs18-Dec-06 11:51
lctrncs18-Dec-06 11:51 
GeneralRe: Multiple application instances-how prevent multiple file instances or file overwrite Pin
Mark Salsbery15-Dec-06 8:59
Mark Salsbery15-Dec-06 8:59 
GeneralRe: Multiple application instances-how prevent multiple file instances or file overwrite Pin
Mark Salsbery14-Dec-06 16:18
Mark Salsbery14-Dec-06 16:18 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.