- Newbie Subclassing Questions.
- Posted by Larry Lindstrom on November 22nd, 2003
Hi Folks:
I have a read only list box as a child of a dialogbox.
When the user clicks anywhere in this list box my code
needs to bring up a new dialog box where the user can edit
the content displayed in the list box.
The following in my dialogproc failed to trap the
mouseclick.
case WM_COMMAND:
switch (LOWORD (wParam))
{
case LIST_BOX_ID:
switch(HIWORD(wParam))
{
case WM_LBUTTONDOWN:
edit_this_data();
return TRUE;
}
break;
So I decided to try window subclassing, and sure
enough, that trapped on the mouseclick.
But I have a couple of questions.
I need to pass a pointer a structure to my subclass
winproc. I know how to pass creation data to a
winproc or dialogproc, and I know how to reserve "extra"
space in a window class I define. But I'm stumped on
sending that information to a subclassed winproc. I'll
do anything to avoid passing this info globally, but I
will do so in a pinch.
I spent a long time wondering if there was a window
style I could have added to my dialog template item
specification that would have told the window to be
alert to mouse clicks. If a task can be accomplished
by specifying a particular style, that seems preferable
to subclassing. Is there a comprehensive reference
that will tell me what styles and SendMessage parameters
I can use. One of my greatest problems is not knowing
of simple solutions that might be right in front of me.
Thanks
Larry
- Posted by James Brown on November 23rd, 2003
Larry,
Use SetWindowLong(hwnd, GWL_USERDATA, value)
or preferably the SetProp API call..
i.e.
SetProp(hwnd, "custom value string", (HANDLE)dword_value);
James
--
www.catch22.org.uk
Free Win32 Software, Source Code and Tutorials
"Larry Lindstrom" <larry@aracnet.com> wrote in message
news:3FBF1FE6.9050009@aracnet.com...
- Newbie questions. (Internet & Broadband) by Paul
- Newbie questions (Windows Media Center Edition) by Debi
- Re: subclassing listbox problem (Development Resources) by Tim Robinson
- Subclassing problem (Development Resources) by IckyPoo
- subclassing buttons (Development Resources) by flintridgeparkenfarker vonkerschnauzerheiden III \(joe\)

