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.
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.
08-07-2006 06:16 PM
08-07-2006 09:22 PM
Hi Scott,
What kernel32 function are you calling, and, can you attach the VI which calls the CLF?
Cheers.
08-08-2006 04:14 PM
TBD-
I have had problems calling DeviceIOControl, CreateFileA, Writefile and others. I am attaching a sample of a vi calling WriteFile.
Thanks,
Scott
08-09-2006 01:45 AM
Hi Scott,
Thanks for the VI - unfortunately I couldn't open it! (LV7.1 here)
You migh back-save it for us cavemen, but first...
I did research WriteFile and put-together this VI in case it points-up any obvious differences from yours (which I doubt.)
A couple of suspected gotcha's are to make sure hFile is not defined as a pointer to value. Use an array of bytes for the buffer (the prototype treats them as a char-array anyway.) Make sure the NumberOfBytesToWrite isn't bigger than the Array-in, the effect of null-writes are file-system dependent - better to avoid it altogether. Make sure NumberOfBytesWritten is pointer to a value (DWORD), and wire the input-side. I hope we're not doing OverLapped writes!
08-09-2006 01:10 PM
TBD -
Thanks for the input. No I do not use overlapped IO. My call looks the same except...
isn't the OVERLAPPED argument a LP (long pointer) ?
Scott
08-09-2006 11:47 PM
Hi Scott,
> isn't the OVERLAPPED argument a LP (long pointer) ?
NO! (well yes, but..) If you specify this parameter as a pointer in the CLF, LabVIEW will pass a non-null pointer value (pointing to a U32), but the DLL will expect to find an Over-lap info-structure where it points.
The way to pass a null-pointer to the DLL is to pass a U32 - by value - set to zero. The DLL, expecting a pointer, will interpret the U32 (set to zero) as a null-pointer - which is what you want.
This will be true anywhere a Null-pointer needs to be passed.
Hope it helps!