|
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.
|
|
|
|
|
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.
|
|
|
|
|
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
|
|
|
|
|
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?
|
|
|
|
|
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
|
|
|
|
|
|
linux c++ use V8 crash,
error:
Fatal error in CALL_AND_RETRY_LAST
Allocation failed - proces out of memory;
use:
CreateParams params;
params.contraints.ConfigureDefaults(1000*1024*1024, 0, 1);
Isolate* New(params)
|
|
|
|
|
At a guess there is a bug in your program, but without more detail and a better explanation it is impossible to suggest anything more.
|
|
|
|
|
I don't know V8. But it seems that you want to allocate about 1 GB (1000 * 1024 * 1024) GB of physical memory and this amount is not available.
This may be due to an internal V8 limit (a quick research found the --max-old-space-size command line flag) or your system has not enough remaining free physical memory.
|
|
|
|
|
Hi,
I don't know if this necessarily a MFC question but ...
I am using CAsyncSockets Class I have hard coded the I/P address from my lap top 10.0.0.205
I am wondering if there is a api that would get me this address I tried CASynSocket::GetSockName ut didn't come up with anything
thanks
|
|
|
|
|
|
for GetAddrInfoEx I would at least need to specify one more parameter like pname for it to work I think I can find out this info on the registry
and use RegGetValue
Thanks
|
|
|
|
|
LONG ret_code;
PVOID ipaddr = new char[100];
DWORD ipaddr_size = 100;
ret_code = RegGetValue(HKEY_LOCAL_MACHINE,
_T ("SYSTEM\\CurrentControlSet\\Services\\Tcpip\\Parameters\\Interfaces\\{CFCAB3F3-0143-4AE0-A915-873AD57C942A}"),
_T("IPAddress"),
RRF_RT_ANY,
NULL,
ipaddr,
&ipaddr_size);
|
|
|
|
|
As the question states, how can I perform this in Direct2D? This needs to be done at real-time ~35fps.
thanks
PKNT
modified 2-Jul-15 11:27am.
|
|
|
|
|
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.
PKNT
|
|
|
|
|
pseduo-code:
foreach (pixel pixel8 in RGBImage)
COLORREF rgb = RGB(pal[pixel8].red, pal[pixel8].green, pal[pixel8].blue);
|
|
|
|
|
Hello there,
in my currect project im trying to communicate between a server and a client codes that I created between 2 computers
with the libraries of winsock2 and windows
In order to sync the send and recv functions I am trying using
the library time.h
but I wish to reset the clock() in a certain area of the code so i could start the count since that point and not since the start of the runtime
*This has nothing to do with my homeworks this is a legeit question*
|
|
|
|
|
Quote: but I wish to reset the clock() in a certain area of the code so i could start the count since that point and not since the start of the runtime
You usually don't do that. Instead, you keep track of your 'zero-time' and subtract it to the current one in order to find out the elapsed interval (You may use difftime[^] for the purpose).
|
|
|
|
|
Hi.
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
CStatic *mytext
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
|
|
|
|