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)
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
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.
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.
Disclaimer: I don't know if Direct2D provide a shortcut for such a operation.
The operation is pretty straightforward: for each input pixel look-up the corresponding palette color and use it to generate the output one. You have to know the bitmap file format in order to do that, however it could be a useful exercise.
Thanks for that suggestion Pallini, I guess I was not clear enough in my questions about how time critical this operation is. In my current application, I do similarly for not so time critical operation. I am looking for something that can do it automatically for me in Direct2D like in OpenCV using LUT & merge commands rather than going pixel by pixel.
I am all sorts of issues displaying a text on my dialog so first let me say what's involved
I have a CStatic ptr says
I instintate this say
mytext = new CStatic;
The next few steps im not sure of the order
So now I want to connect this CWnd object to my resource file Id in my DIALOGEX resource says its a CTEXT so I call UpdateData or CDialog::OnInitDialog which does that for me
The DDX_control connects my CTEXT to mytext CWnd object next I do a mytext->SetWindowText however nothing appears within my CDialog
Do first have to do SetWindowText before DDX_control if DDX_control initilizes the CTEXT with what text is in my text then maybe I do
I have tried all sorts of methods including DrawText to display the text whitin the dialog but I get nothing displayed
Can't you just add the CStatic control to the dialog via the resource editor? Then associate a CString variable to it and use UpdateData()?
In your code how did you size the CStatic control? Did you use the Create() method anywhere to give it its size, style, initial text, etc?
"the debugger doesn't tell me anything because this code compiles just fine" - random QA comment
"Facebook is where you tell lies to your friends. Twitter is where you tell the truth to strangers." - chriselst
"I don't drink any more... then again, I don't drink any less." - Mike Mullikins uncle
Last Visit: 22-Feb-20 4:24 Last Update: 22-Feb-20 4:24