WNDCLASS: cbWndExtra

K

Karel Bruneel

Hi,

Is this right?

1)if I register a WNDCLASS in witch set cbWndExtra to a value greater than
0, this means that every time I create a window of that class there will be
an extra amount of memory alocated.

2)I can put something into that extra memory.

If the two statements are correct:

How can I write and read from that extra memory.

Thank you
Karel Bruneel
 
A

Alf P. Steinbach

Hi,

Is this right?

1)if I register a WNDCLASS in witch set cbWndExtra to a value greater than
0, this means that every time I create a window of that class there will be
an extra amount of memory alocated.

Not necessarily, but there's an extra amount of memory _available_ for
your use.


2)I can put something into that extra memory.

Yes.

But since every Win32 window has room for a user-defined pointer you
generally don't need to specify more storage.

It's a relic from 16-bit Windows.


(Note that there are many other ways to associate data with a window,
including (1) SetProp/GetProp, (2) dynamically generated window proc
stub, and (3) static association table.)

If the two statements are correct:

How can I write and read from that extra memory.

GetWindowLong, SetWindowLong.
 
A

Alf P. Steinbach

I'm sorry, I didn't notice this was crossposted to [comp.lang.c++].

Karel: DON'T DO THAT.

Or else... ;-)
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,769
Messages
2,569,579
Members
45,053
Latest member
BrodieSola

Latest Threads

Top