09-29-2006 02:03 PM
09-29-2006 02:14 PM
09-29-2006 05:05 PM
07-08-2009 01:33 AM
Lycangeek wrote:1. Strange! I have no response to that one...
To the question why GetLastError() does not seem to work:
I do! Windows maintains a last error code on a per thread base. Since LabVIEW is highly multithreading the only case where you can reasonably assume that between a CLN calling some API influencing the last error and the call to GetLastError() will actually return the right thing, is only when both CLN are configured to be executed in the UI thread.
Even then there is no guarantee, since LabVIEW will do a lot of other things in the UI thread too, such as updating its UI and also doing synchronisation of asynchronous events. Many of these operations will at some point call Windows API functions that can change the last error code too.
So the use of GetLastError() through a CLN in a LabVIEW diagram is basically useless. To make this work you have to write an external C code function that executes the actual API and retrieves the error with GetLastError() and call that new function through the CLN.
Rolf Kalbermatter