nanogui: Length of Window extra bytes.


Previous by date: 17 Jan 2000 23:20:26 -0000 Re: Length of Window extra bytes., Greg Haerr
Next by date: 17 Jan 2000 23:20:26 -0000 Re: Length of Window extra bytes., Greg Haerr
Previous in thread: 17 Jan 2000 23:20:26 -0000 Re: Length of Window extra bytes., Greg Haerr
Next in thread: 17 Jan 2000 23:20:26 -0000 Re: Length of Window extra bytes., Greg Haerr

Subject: Re: Length of Window extra bytes.
From: Chris Johns ####@####.####
Date: 17 Jan 2000 23:20:26 -0000
Message-Id: <3883A14A.61320928@acm.org>

Greg Haerr wrote:
> 
> : 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 *)...
> 

Oh. I assumed that the `lpParam' was just not implemented and was to be
implemented. What is the purpose of the `lpParam' parameter when
creating a window ?

I cannot use the WM_CREATE message as I do not yet know the relationship
between the C++ object and hwnd when my WndProc function is called
(assuming synchronous message sends).

I have a single `WndProc' function for all windows created using a
window class created with the WindowClass class (blah, too many
classes). In my common WndProc function I need to obtain the object
pointer so I can call a virtual method `HandleMessage'. This is my per
window object WndProc function.

I see in the demo code the `HMENU' window create parameter is really an
`id' and it is used to handle different windows from within a common
WndProc function. I would use `id' how-ever is only an `int' and I
cannot assume the size of int is large enough for a pointer.

-- 
 Chris Johns, ####@####.####

Previous by date: 17 Jan 2000 23:20:26 -0000 Re: Length of Window extra bytes., Greg Haerr
Next by date: 17 Jan 2000 23:20:26 -0000 Re: Length of Window extra bytes., Greg Haerr
Previous in thread: 17 Jan 2000 23:20:26 -0000 Re: Length of Window extra bytes., Greg Haerr
Next in thread: 17 Jan 2000 23:20:26 -0000 Re: Length of Window extra bytes., Greg Haerr


Powered by ezmlm-browse 0.20.