From Friday, April 19th (11:00 PM CDT) through Saturday, April 20th (2:00 PM CDT), 2024, ni.com will undergo system upgrades that may result in temporary service interruption.

We appreciate your patience as we improve our online experience.

LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

CreateEvent() returns 0

Solved!
Go to solution
Looks like all this moving a discussion from one topic to another only made it more messy...
In that second topic:
@Thoric wrote:

 

In your Call Library Function Node (CLFN), go to the Error Checking tab and select Maximum. This will cause LV to take extra precautions when calling the dll and might help prevent the crash, allowing you to experiment with different calling parameters etc.

 

The WaitForSingleObject function does not take a floating point input at the second parameter. Your coercion dot shows that you're asking LabVIEW to coerce a positive infinity to an integer, which isn't going to work. Read the MSDN help on this call to learn that the timeout is in milliseconds, and "infinite" is a special case of 0xFFFFFFF. Use the maximum an unsigned 32-bit value can hold, which is 4294967295. This is the special infinite case.


Maximum error checking didn't help and the code still crushes without any information.

Also using the maximum U32 value didn't solve the problem. 

What's more I've just noticed, that calling WaitForSingleObject function causes a plugged camera hang up. 

0 Kudos
Message 11 of 17
(1,052 Views)

@turbolek wrote:
Looks like all this moving a discussion from one topic to another only made it more messy...
In that second topic:
@Thoric wrote:

 

In your Call Library Function Node (CLFN), go to the Error Checking tab and select Maximum. This will cause LV to take extra precautions when calling the dll and might help prevent the crash, allowing you to experiment with different calling parameters etc.

 

The WaitForSingleObject function does not take a floating point input at the second parameter. Your coercion dot shows that you're asking LabVIEW to coerce a positive infinity to an integer, which isn't going to work. Read the MSDN help on this call to learn that the timeout is in milliseconds, and "infinite" is a special case of 0xFFFFFFF. Use the maximum an unsigned 32-bit value can hold, which is 4294967295. This is the special infinite case.


Maximum error checking didn't help and the code still crushes without any information.

Also using the maximum U32 value didn't solve the problem. 

What's more I've just noticed, that calling WaitForSingleObject function causes a plugged camera hang up. 


No, it's only messy because you started replying in both threads, contrary to the advice given.

Bill
CLD
(Mid-Level minion.)
My support system ensures that I don't look totally incompetent.
Proud to say that I've progressed beyond knowing just enough to be dangerous. I now know enough to know that I have no clue about anything at all.
Humble author of the CLAD Nugget.
0 Kudos
Message 12 of 17
(1,040 Views)

Can you see any reply I've posted in that topic? No? Right because I didn't. Can we please leave that issue alone and focus on LabVIEW instead?

I am attaching a piece of code to illustrate the problem.

0 Kudos
Message 13 of 17
(1,021 Views)
Solution
Accepted by turbolek

OK, I've gound a solution finally. It was all about changing Calling Convention of WaitForSingleObject function from C to stdcall(WINAPI). Seems obvious, but I must have missed it :]

Thanks for your help, everybody.

0 Kudos
Message 14 of 17
(1,008 Views)

@turbolek wrote:

Can you see any reply I've posted in that topic? No? Right because I didn't. Can we please leave that issue alone and focus on LabVIEW instead?

I am attaching a piece of code to illustrate the problem.


I can see why you were upset.  I had forgotten that I had already posted about that.  My apologies.

Bill
CLD
(Mid-Level minion.)
My support system ensures that I don't look totally incompetent.
Proud to say that I've progressed beyond knowing just enough to be dangerous. I now know enough to know that I have no clue about anything at all.
Humble author of the CLAD Nugget.
0 Kudos
Message 15 of 17
(995 Views)

@turbolek wrote:

OK, I've gound a solution finally. It was all about changing Calling Convention of WaitForSingleObject function from C to stdcall(WINAPI). Seems obvious, but I must have missed it :]

Thanks for your help, everybody.


You're welcome. Glad you worked it out. Those options are easily missed! Smiley Very Happy

Thoric (CLA, CLED, CTD and LabVIEW Champion)


0 Kudos
Message 16 of 17
(988 Views)

I came across a similar issue, thank you for your code. I changed it to make it work on LabVIEW 2017 SP1 + Windows 10, see attached VI. I also improved the UI a bit.


Ingo – LabVIEW 2013, 2014, 2015, 2016, 2017, 2018, NXG 2.0, 2.1, 3.0
CLADMSD
0 Kudos
Message 17 of 17
(819 Views)