LabWindows/CVI

cancel
Showing results for 
Search instead for 
Did you mean: 

Problem with calling Kernel32 function "Sleep()"

Hi there

I cannot seem to get this to work. In LabWindows I want to be able to call the Sleep function.

But when I #Include "Windows.h" I get errors that it cannot build:
"Redeclearation of 'CVI_GetFileSize' previous declared at utility.h:249"

The error stems from Winbase.h, which is included in Windows.h. The relevant
lines in Winbase.h is:

WINBASEAPI
DWORD
WINAPI
GetFileSize(
HANDLE hFile,
LPDWORD lpFileSizeHigh
);


Anybody had this error. Utility.h is a header that is included for other
function vital to Labwindows and it seems odd to me that there is
declaration overlap.....

Thanks

Klaus
0 Kudos
Message 1 of 4
(3,527 Views)
Hello

Make sure you include windows.h as the very first header in your header section.

Hope this helps

Bilal Durrani
NI
Bilal Durrani
NI
0 Kudos
Message 2 of 4
(3,524 Views)
Thanks Bilal

That worked like a charm 🙂

Klaus
0 Kudos
Message 3 of 4
(3,524 Views)
A tip for anyone else trying to implement sleep().  If the include windows.h generates compiler errors, you can also try basicsdk.h.
This will give you sleep() functionality without all the extra declarations that can cause problems with CVI.
0 Kudos
Message 4 of 4
(3,391 Views)