c++.windows.16-bits - Sizeof(HWND) for Win16
- Mark Evans <mevans zyvex.com> Jun 25 2001
- Jan Knepper <jan smartsoft.cc> Jun 25 2001
- Mark Evans <mevans zyvex.com> Jun 25 2001
- "Walter" <walter digitalmars.com> Jun 25 2001
- "Kar Gay Lim" <kagay kimay.net> Jun 26 2001
Is the byte size of an HWND under Win16 large model officially 2 bytes or 4? I would suppose that like any other far pointer, it would be 4 bytes. However as a test, I did the following in a WINIO program: printf("sizeof(HWND) = %ld",(long) sizeof(HWND)); and got sizeof(HWND) = 2 This is a little surprising. Is the sizeof() function automatically assuming a near pointer when in fact an HWND can be near or far? What is the story here? Maybe the sizeof HWND was always 2 bytes under Win16 but I was never a Win16 guru. Mark
Jun 25 2001
I don't think HWND was a pointer on Win16, but a handle and the number of handles is limited. HTH Jan Mark Evans wrote:Is the byte size of an HWND under Win16 large model officially 2 bytes or 4? I would suppose that like any other far pointer, it would be 4 bytes. However as a test, I did the following in a WINIO program: printf("sizeof(HWND) = %ld",(long) sizeof(HWND)); and got sizeof(HWND) = 2 This is a little surprising. Is the sizeof() function automatically assuming a near pointer when in fact an HWND can be near or far? What is the story here? Maybe the sizeof HWND was always 2 bytes under Win16 but I was never a Win16 guru. Mark
Jun 25 2001
Well I know it's a handle, but that's just a pointer to a pointer to data. The amount of indirection is not the issue. The size in bytes of the data type is the issue. Are you saying that a Win16 HWND is in fact two bytes, which in turn limits the number of HWNDs? Are HWNDs stored in some "magic segment" such that the segment information is not needed at runtime? I looked at the typedef in Windows.h, and it's nontrivial, but in the end looks like 2 bytes to me....please confirm. I don't need too much information about the whys and wherefores of Win16, just confirmation that my head is screwed on straight thinking that HWND is two bytes. It came as a surprise. Thanks, Mark On Mon, 25 Jun 2001 14:28:58 -0400, Jan Knepper <jan smartsoft.cc> wrote:I don't think HWND was a pointer on Win16, but a handle and the number of handles is limited. HTH Jan Mark Evans wrote:Is the byte size of an HWND under Win16 large model officially 2 bytes or 4? I would suppose that like any other far pointer, it would be 4 bytes. However as a test, I did the following in a WINIO program: printf("sizeof(HWND) = %ld",(long) sizeof(HWND)); and got sizeof(HWND) = 2 This is a little surprising. Is the sizeof() function automatically assuming a near pointer when in fact an HWND can be near or far? What is the story here? Maybe the sizeof HWND was always 2 bytes under Win16 but I was never a Win16 guru. Mark
Jun 25 2001
It's always 16 bits in win16. -Walter Mark Evans wrote in message <1104_993494621 evans>...Well I know it's a handle, but that's just a pointer to a pointer to data.
type is the issue.Are you saying that a Win16 HWND is in fact two bytes, which in turn limits
segment information isnot needed at runtime? I looked at the typedef in Windows.h, and it's nontrivial, but in the end
information about the whys and wherefores ofWin16, just confirmation that my head is screwed on straight thinking that
Thanks, Mark On Mon, 25 Jun 2001 14:28:58 -0400, Jan Knepper <jan smartsoft.cc> wrote:I don't think HWND was a pointer on Win16, but a handle and the number of
HTH Jan Mark Evans wrote:Is the byte size of an HWND under Win16 large model officially 2 bytes
I would suppose that like any other far pointer, it would be 4 bytes.
printf("sizeof(HWND) = %ld",(long) sizeof(HWND)); and got sizeof(HWND) = 2 This is a little surprising. Is the sizeof() function automatically
the story here?Maybe the sizeof HWND was always 2 bytes under Win16 but I was never a
Mark
Jun 25 2001
You have to understand that Win16 is "medium" memory model. i.e. Data segment in the DLL is only 64k and hence the limited system resources. The handles are 16-bit for that reason. Walter <walter digitalmars.com> wrote in message news:9h8t4s$1b07$1 digitaldaemon.com...It's always 16 bits in win16. -Walter Mark Evans wrote in message <1104_993494621 evans>...Well I know it's a handle, but that's just a pointer to a pointer to data.
type is the issue.Are you saying that a Win16 HWND is in fact two bytes, which in turn limits
segment information isnot needed at runtime? I looked at the typedef in Windows.h, and it's nontrivial, but in the end
information about the whys and wherefores ofWin16, just confirmation that my head is screwed on straight thinking that
Thanks, Mark On Mon, 25 Jun 2001 14:28:58 -0400, Jan Knepper <jan smartsoft.cc> wrote:I don't think HWND was a pointer on Win16, but a handle and the number of
HTH Jan Mark Evans wrote:Is the byte size of an HWND under Win16 large model officially 2 bytes
I would suppose that like any other far pointer, it would be 4 bytes.
printf("sizeof(HWND) = %ld",(long) sizeof(HWND)); and got sizeof(HWND) = 2 This is a little surprising. Is the sizeof() function automatically
the story here?Maybe the sizeof HWND was always 2 bytes under Win16 but I was never a
Mark
Jun 26 2001