Does anyone know what range of values Windows chooses from when
creating a handle value ?
I ask, because while trying to discover why NT4 was randomly failing
to render images in my PBDLL6 program, I found that LoadBitmap() was
generating bitmap handles beyond the range of a LONG (2,835,677,702
was one such). This was easily cured by using a DWORD to reference the
loaded bitmap.
By comparison, Win98 SE has never yet (well, in 6 weeks' use) created
a bitmap handle that couldn't be referenced correctly by a LONG.
It seems however that dialog handles *can* always be represented by a
LONG, borne out for example by DDT's "DIALOG NEW ... TO hDlg&".
Either there's an underlying rule, or you have to check the range of
possible handle values for each type of object you reference. The Win32
SDK doesn't have the answer (AFAICS) - it just says HBITMAP in this case,
which leads to Windows header files, of which there are 315 in my VC++6
\Include folder... (the pointed-to WINUSER.H does not it seems contain
a definition of HBITMAP).
Anyway for the general case, there must be an easier way - any thoughts ?
Cheers,
Paul
creating a handle value ?
I ask, because while trying to discover why NT4 was randomly failing
to render images in my PBDLL6 program, I found that LoadBitmap() was
generating bitmap handles beyond the range of a LONG (2,835,677,702
was one such). This was easily cured by using a DWORD to reference the
loaded bitmap.
By comparison, Win98 SE has never yet (well, in 6 weeks' use) created
a bitmap handle that couldn't be referenced correctly by a LONG.
It seems however that dialog handles *can* always be represented by a
LONG, borne out for example by DDT's "DIALOG NEW ... TO hDlg&".
Either there's an underlying rule, or you have to check the range of
possible handle values for each type of object you reference. The Win32
SDK doesn't have the answer (AFAICS) - it just says HBITMAP in this case,
which leads to Windows header files, of which there are 315 in my VC++6
\Include folder... (the pointed-to WINUSER.H does not it seems contain
a definition of HBITMAP).
Anyway for the general case, there must be an easier way - any thoughts ?
Cheers,
Paul
Comment