nanogui: Length of Window extra bytes.


Previous by date: 17 Jan 2000 22:35:24 -0000 Re: Length of Window extra bytes., Chris Johns
Next by date: 17 Jan 2000 22:35:24 -0000 Re: Length of Window extra bytes., Chris Johns
Previous in thread: 17 Jan 2000 22:35:24 -0000 Re: Length of Window extra bytes., Chris Johns
Next in thread: 17 Jan 2000 22:35:24 -0000 Re: Length of Window extra bytes., Chris Johns

Subject: RE: Length of Window extra bytes.
From: Greg Haerr ####@####.####
Date: 17 Jan 2000 22:35:24 -0000
Message-Id: <C1962B36D9BBD311B0F80060083DFEFB04121B@SYS.CenSoft.COM>

: I suspect I cannot use the extra bytes for storing the object pointer as
: a SendMessage occurs and the object pointer is not loaded into the
: window structure when this occurs.
: 
: I added the "LPVOID lpParam" to the `struct hwnd' and set it. I also
: added a macro to access it.
: 

No, the extra bytes are just bytes adjacent to the struct hwnd.  You don't
want to add another element to struct hwnd, or every window takes
up extra space.  The proper way is to fill out the cbWndExtra field
with as follows:

	wc.cbWndExtra = sizeof(LPVOID);

before calling RegisterClass().  Then, in the window procedure
for that class, under WM_CREATE:
	
	SetWindowLong(hwnd, 0, your_lpvoid);

You can then always access this value with:
	
	pvoid = (LPVOID)GetWindowLong(hwnd, 0);

As I check the source, you'll need to write SetWindowLong
yourself, use microwin/src/mwin/winuser.c's SetWindowWord
as a base, and return a *(LONG *) rather than *(WORD *)...



Regards,

Greg

Previous by date: 17 Jan 2000 22:35:24 -0000 Re: Length of Window extra bytes., Chris Johns
Next by date: 17 Jan 2000 22:35:24 -0000 Re: Length of Window extra bytes., Chris Johns
Previous in thread: 17 Jan 2000 22:35:24 -0000 Re: Length of Window extra bytes., Chris Johns
Next in thread: 17 Jan 2000 22:35:24 -0000 Re: Length of Window extra bytes., Chris Johns


Powered by ezmlm-browse 0.20.