Click here to Skip to main content
15,888,351 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralRe: SetWindowsHookEx failed Pin
Member 1410515514-Jan-20 16:43
Member 1410515514-Jan-20 16:43 
GeneralRe: SetWindowsHookEx failed Pin
Richard MacCutchan14-Jan-20 21:40
mveRichard MacCutchan14-Jan-20 21:40 
QuestionIsFileReady Pin
Erich Ruth12-Jan-20 13:34
Erich Ruth12-Jan-20 13:34 
AnswerRe: IsFileReady Pin
leon de boer12-Jan-20 14:52
leon de boer12-Jan-20 14:52 
AnswerRe: IsFileReady Pin
Stefan_Lang12-Jan-20 23:21
Stefan_Lang12-Jan-20 23:21 
GeneralRe: IsFileReady Pin
leon de boer12-Jan-20 23:52
leon de boer12-Jan-20 23:52 
SuggestionRe: IsFileReady Pin
David Crow13-Jan-20 5:02
David Crow13-Jan-20 5:02 
AnswerRe: IsFileReady Pin
Daniel Pfeffer13-Jan-20 23:38
professionalDaniel Pfeffer13-Jan-20 23:38 
If you are waiting for the file to be fully created (i.e. completely written), then this code won't work. At best, it will wait until the file is created (i.e. when the other task opens it for writing).

The problem may be broken into two steps:
  1. Wait until the file is created (i.e. it appears in the directory)
  2. Wait until the file is closed (i.e. the writing is completed)
Others have given you good ideas about how to wait for the file to be created. In order to wait for the file to be completely written, the best way would be for the other application to create another file AFTER it is done with the data file. For example:
  1. Your application waits for the creation of DATA.DAT
  2. Other application creates file DATA.DAT (your application detects the creation)
  3. Other application writes into DATA.DATA (your application waits for the creation of FINISHED.DAT)
  4. Other application closes DATA.DAT
  5. Other application creates FINISHED.DAT (your application detects FINISHED.DAT, and knows that DATA.DAT is ready)
There are some other points to handle (e.g. what happens if DATA.DAT is created before your application starts waiting for it?), but this is the basic idea.
Freedom is the freedom to say that two plus two make four. If that is granted, all else follows.
-- 6079 Smith W.

GeneralRe: IsFileReady Pin
Joe Woodbury14-Jan-20 20:15
professionalJoe Woodbury14-Jan-20 20:15 
GeneralRe: IsFileReady Pin
Daniel Pfeffer14-Jan-20 20:58
professionalDaniel Pfeffer14-Jan-20 20:58 
QuestionVeteran VS2008 users here? Ever lost your debug functions? Pin
charlieg9-Jan-20 1:59
charlieg9-Jan-20 1:59 
AnswerRe: Veteran VS2008 users here? Ever lost your debug functions? Pin
Afzaal Ahmad Zeeshan9-Jan-20 22:28
professionalAfzaal Ahmad Zeeshan9-Jan-20 22:28 
GeneralRe: Veteran VS2008 users here? Ever lost your debug functions? Pin
charlieg10-Jan-20 3:51
charlieg10-Jan-20 3:51 
AnswerRe: Veteran VS2008 users here? Ever lost your debug functions? Pin
phil.o9-Jan-20 22:46
professionalphil.o9-Jan-20 22:46 
GeneralRe: Veteran VS2008 users here? Ever lost your debug functions? Pin
charlieg10-Jan-20 3:53
charlieg10-Jan-20 3:53 
AnswerRe: Veteran VS2008 users here? Ever lost your debug functions? Pin
_Flaviu9-Jan-20 23:19
_Flaviu9-Jan-20 23:19 
GeneralRe: Veteran VS2008 users here? Ever lost your debug functions? Pin
charlieg10-Jan-20 3:58
charlieg10-Jan-20 3:58 
AnswerRe: Veteran VS2008 users here? Ever lost your debug functions? Pin
charlieg10-Jan-20 4:15
charlieg10-Jan-20 4:15 
AnswerRe: Veteran VS2008 users here? Ever lost your debug functions? Pin
charlieg21-Jan-20 11:53
charlieg21-Jan-20 11:53 
Questionsrandom and random Pin
_Flaviu9-Jan-20 0:44
_Flaviu9-Jan-20 0:44 
AnswerRe: srandom and random Pin
phil.o9-Jan-20 1:03
professionalphil.o9-Jan-20 1:03 
GeneralRe: srandom and random Pin
_Flaviu9-Jan-20 2:29
_Flaviu9-Jan-20 2:29 
AnswerRe: srandom and random Pin
Richard MacCutchan9-Jan-20 1:26
mveRichard MacCutchan9-Jan-20 1:26 
SuggestionRe: srandom and random Pin
David Crow9-Jan-20 3:25
David Crow9-Jan-20 3:25 
GeneralRe: srandom and random Pin
_Flaviu9-Jan-20 6:42
_Flaviu9-Jan-20 6:42 

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.