🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: comp.windows.ms.programmer
Article #2746

Re: Windows extra bytes

#2746
From: Ken SYKES
Date: Sun, 19 May 1991 21:02
31 lines
1764 bytes
In article <1991May16.080047.3388@rci.dk> neh@rci.dk (Niels Erik Holm) writes:
>
>What I would like to is to store the structure (not just the index) 
>associated with the window in the extra bytes allocated behind the
>(internal) windows structure.
>
>   ...
>   wc.cbWndExtra = sizeof(struct ...);
>   ...
>   RegisterClass(&wc);		/* Register the window class */
>
>
>My question is now: How can I get the address of the windows structure ?
>It is necessary to know the address in order to access the extra data area
>efficiently.
>

First thing to remember is that the window structure sits in USER's heap
and putting big structures in there will drain the system resources
quickly.  If you want to put a big structure (say, > 10 bytes or so) in
the window handle think about putting a Local or Global memory handle
in there instead.  

Now, if you want to put a small structure in there you can use a macro to
map a field in the structure to an index in the window and use GetWindowWord.
If you're really concerned about speed a fixed local memory handle is
probably your best bet.  Yank it out at the top of the function and then
you have your pointer to your structure.

Ken Sykes
Disclaimer: The above opinions are solely my own.
Technical Details
Message-ID: <72430@microsoft.UUCP>
Path: arc1-ca.pugleaf.net!utzoo!utgpu!news-server.csri.toronto.edu!rpi!usc!zaphod.mps.ohio-state.edu!mips!spool.mu.edu!uunet!microsoft!kensy
References: <1991May16.080047.3388@rci.dk>

Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!utzoo!utgpu!news-server.csri.toronto.edu!rpi!usc!zaphod.mps.ohio-state.edu!mips!spool.mu.edu!uunet!microsoft!kensy
From: kensy@microsoft.UUCP (Ken SYKES)
Newsgroups: comp.windows.ms.programmer
Subject: Re: Windows extra bytes
Keywords: RegisterWindow,CreateWindow,cbWndExtra
Message-ID: <72430@microsoft.UUCP>
Date: 19 May 91 21:02:04 GMT
References: <1991May16.080047.3388@rci.dk>
Reply-To: kensy@microsoft.UUCP (Ken SYKES)
Organization: Microsoft Corp., Redmond WA
Lines: 31