Waiting for open files
-
Hi i am developing an application CListCtrl based, which can open more files listed inside, to do this i did thread for every file will be clicked, the problem is when i close a file i'd like to do some check operations on file, but using WaitForMultipleObjects it wait first i close all files and then perform the operations, with WaitForSingleObjects it wait only for first file and ignore the others. I'd like so: 1) i open the file1.pdf - the program wait. 2) i open the file2.pdf - the program wait. 3) i close the file "file1.pdf" - the program perform operations on file1 (the file2.pdf is waiting) Please i hope somebody can help me Giovanni
-
Hi i am developing an application CListCtrl based, which can open more files listed inside, to do this i did thread for every file will be clicked, the problem is when i close a file i'd like to do some check operations on file, but using WaitForMultipleObjects it wait first i close all files and then perform the operations, with WaitForSingleObjects it wait only for first file and ignore the others. I'd like so: 1) i open the file1.pdf - the program wait. 2) i open the file2.pdf - the program wait. 3) i close the file "file1.pdf" - the program perform operations on file1 (the file2.pdf is waiting) Please i hope somebody can help me Giovanni
WaitForMultipleOjects has a flag that decides whether it waits for all the handles to be signaled, or just one. Read the documentation.
The difficult we do right away... ...the impossible takes slightly longer.
-
WaitForMultipleOjects has a flag that decides whether it waits for all the handles to be signaled, or just one. Read the documentation.
The difficult we do right away... ...the impossible takes slightly longer.
-
Hi thanks for response i have already tried about WaitForMultipleObjects but the function wait until all opened files will be closed if i flag it TRUE. If a flag it FALSE become similar to WaitForSingleObjects
The return value from WaitForMultipleObjects tells you which handle was signaled. You're supposed to check the return value to figure out which handle was signaled.
The difficult we do right away... ...the impossible takes slightly longer.
-
The return value from WaitForMultipleObjects tells you which handle was signaled. You're supposed to check the return value to figure out which handle was signaled.
The difficult we do right away... ...the impossible takes slightly longer.
i try to understand you i need to do this: open 3 pdf with WaitForMultipleObjects(Array.GetCount(), Array.GetData(), FALSE, INFINITE); and after user modifed pdf i need to save and delete from TMP folder. if i use FALSE like i show you first i obtain the right signaled file number but the file was deleted without open becouse WaitForMultipleObjects do not block the execution maybe becouse the acrobat is already loaded
-
Hi i am developing an application CListCtrl based, which can open more files listed inside, to do this i did thread for every file will be clicked, the problem is when i close a file i'd like to do some check operations on file, but using WaitForMultipleObjects it wait first i close all files and then perform the operations, with WaitForSingleObjects it wait only for first file and ignore the others. I'd like so: 1) i open the file1.pdf - the program wait. 2) i open the file2.pdf - the program wait. 3) i close the file "file1.pdf" - the program perform operations on file1 (the file2.pdf is waiting) Please i hope somebody can help me Giovanni
Giovanni they already explained to you that WaitForSingleObjects returns with the index of the event in the array that has been set. When you get it simply inspect the return value, identify the file and execute the operations sequential to file closure. Then remove the event from the array then repeat the WaitForSingleObjects with one element less in array. Repeat it until there are no more events in the array. Buona fortuna.
-
Giovanni they already explained to you that WaitForSingleObjects returns with the index of the event in the array that has been set. When you get it simply inspect the return value, identify the file and execute the operations sequential to file closure. Then remove the event from the array then repeat the WaitForSingleObjects with one element less in array. Repeat it until there are no more events in the array. Buona fortuna.
I have tried for all day and i have always the same for first file is all ok and from second the system do not wait, becouse my english is not perfect like yours i luckly found an user response to show you so i can be more specific: "What happens depends on the application that is registered to open PDF or JPG files. If you open the documents in an SDI application, then every CreateProcess() call returns a process handle for an application, which you can wait for - this will return when the application editing the document closes. If however an application is limited to a single instance, then every further call will return as soon as the new instance has passed the data to the first instance (which will usually open the document in a new frame), and then has exited. I think that is what happens in your case, probably you are using Acrobat Reader to open the PDF files" The problem for me is clear the question is: it's possibile manage this problem using some workaround?
-
I have tried for all day and i have always the same for first file is all ok and from second the system do not wait, becouse my english is not perfect like yours i luckly found an user response to show you so i can be more specific: "What happens depends on the application that is registered to open PDF or JPG files. If you open the documents in an SDI application, then every CreateProcess() call returns a process handle for an application, which you can wait for - this will return when the application editing the document closes. If however an application is limited to a single instance, then every further call will return as soon as the new instance has passed the data to the first instance (which will usually open the document in a new frame), and then has exited. I think that is what happens in your case, probably you are using Acrobat Reader to open the PDF files" The problem for me is clear the question is: it's possibile manage this problem using some workaround?
Let me understand: 1. you don't open the files in your program, but you create a new process to run an app that open the file. 2. You are not waiting on a file, but on the process to end. So if the process opens multiple files you got no notifications. If this is the scenario maybe you have to use a different strategy to be notified right on files changes. Check the directory change notifications[^] ;)
-
Let me understand: 1. you don't open the files in your program, but you create a new process to run an app that open the file. 2. You are not waiting on a file, but on the process to end. So if the process opens multiple files you got no notifications. If this is the scenario maybe you have to use a different strategy to be notified right on files changes. Check the directory change notifications[^] ;)
-
Right now you have understood i was looking for directory change but i haven't found something as example to test the possibility, if you can show me some example please
-
WaitForMultipleOjects has a flag that decides whether it waits for all the handles to be signaled, or just one. Read the documentation.
The difficult we do right away... ...the impossible takes slightly longer.
Waiting for open files Each error code page [url=http://cali88.net/xoc-dia/\]xoc dia[/url], [url=http://cali88.net/song-bai-truc-tuyen/\]song bai[/url] that does not fix the core dia Consortium is