Discussion:
What is the mean of definition of INVALID_HANDLE_VALUE
(too old to reply)
kimi
2004-08-19 03:48:15 UTC
Permalink
#define INVALID_HANDLE_VALUE ((HANDLE)(ULONG_PTR)-1)

so, What number of INVALID_HANDLE_VALUE is? Why does it mean invalid handle?
thank you !
William DePalo [MVP VC++]
2004-08-19 04:14:36 UTC
Permalink
Post by kimi
#define INVALID_HANDLE_VALUE ((HANDLE)(ULONG_PTR)-1)
so, What number of INVALID_HANDLE_VALUE is? Why does it mean invalid handle?
Some API functions, such as CreateFile() are defined to return a handle. If
a handle with a "value" of -1 is returned it means that the function failed.

Regards,
Will
Scott McPhillips [MVP]
2004-08-19 05:16:14 UTC
Permalink
Post by kimi
#define INVALID_HANDLE_VALUE ((HANDLE)(ULONG_PTR)-1)
so, What number of INVALID_HANDLE_VALUE is? Why does it mean invalid handle?
thank you !
It is -1, but it is not a number type. It is a HANDLE type. It means
invalid handle because that is what Microsoft returns if they detect an
invalid handle from your code.
--
Scott McPhillips [VC++ MVP]
Continue reading on narkive:
Loading...