08-11-2014 08:03 AM
Hello everyone,
I am using this code to call CreateEvent function:
It works fine, but not always. When I run for the first time, it returns correct, nonzero value. But when I call it second time, the return value is 0. Then, calling it for the third time will result in returning nonzero, and 4th - zero again etc.
Using CloseHandle() function between calls doesn't help.
Solved! Go to Solution.
08-11-2014 08:10 AM
Hi turbolek,
please stick with one thread for this topic!
As long as you only post images nobody is able to help you! We don't know which functions you are calling nor do we know the settings you made in the CLFN!
08-11-2014 08:22 AM
Sorry, you're right. I didn't want to post all huge code, so thought that images will be the best solution, but now I've created new VI, including just the part I am talking about.
So, in attached VI there's the same issue than described before - 2nd, 4th, etc. run results in returning 0.
08-11-2014 08:24 AM - edited 08-11-2014 08:24 AM
@turbolek wrote:
Sorry, you're right. I didn't want to post all huge code, so thought that images will be the best solution, but now I've created new VI, including just the part I am talking about.
So, in attached VI there's the same issue than described before - 2nd, 4th, etc. run results in returning 0.
He's also right that you should stick to one thread.
08-11-2014 08:32 AM
OK, I should have but now I don't know how to merge this topics or delete one of them.
08-11-2014 08:40 AM - edited 08-11-2014 08:41 AM
Hi turbolek,
I don't know how to merge this topics or delete one of them.
You cannot merge or delete threads, this is only upto the forum admins. You can use links in your messages to indicate a discussion was continued in a different thread (as I already have done in your other thread.)
Did you read the MSDN entry on CreateEventA()? It says:
If the function fails, the return value is NULL. To get extended error information, call GetLastError.
08-12-2014 05:03 AM
GetLastError returns 998, but I can't find a complete solution of this issue neither on this board nor anywhere else.
08-12-2014 05:24 AM
08-12-2014 05:27 AM
It solved it, thanks :]
08-12-2014 06:23 AM
OK, so here comes another question from that similar topic mentioned before.
Whenever I try to call WaitForSingleObject function using an Event Handle that I received from just solved piece of code, LabVIEW immediately shuts down. There are not any error reports or something.
I guess I am calling it wrong again as I couldn't find any working example of using this function in LabVIEW. The second DWORD parameter is especially tricky, because I don't have any idea how to pass INFINITE (described HERE) value using LabVIEW.
Can somebody share a working example of WaitForSingleObject use in LabVIEW, please?