Re: Crash when overriding tree view wndproc

"Pierre Terdiman" <[email protected]> Wed, 4 Jul 2007 15:38:18 +0200
Newsgroups gmane.games.devel.windows
Message-ID <[email protected]>
Excellent, this seems to work!

Thanks!
- Pierre

----- Original Message ----- 
From: "Roman Keskenti" <[email protected]>
To: "Game Development for MS Windows"
<[email protected]>
Sent: Wednesday, July 04, 2007 3:30 PM
Subject: [****** SPAM: ******] Re: [GD-Windows] Crash when overriding tree
view wndproc


> Pierre,
>
> i think you're supposed to use the CallWindowProc API instead of calling
the
> superclass proc yourself.
>
> static LRESULT CALLBACK MyTreeViewWndProc(HWND hwnd, UINT uMessage, WPARAM
> wParam, LPARAM lParam)
> {
>     return ::CallWindowProc( OldWndProc, hwnd, uMessage, wParam, lParam);
> }
>
> Roman
>
> ----- Original Message ----- 
> From: "Pierre Terdiman" <[email protected]>
> To: "Game Development for MS Windows"
> <[email protected]>
> Sent: Wednesday, July 04, 2007 3:23 PM
> Subject: [GD-Windows] Crash when overriding tree view wndproc
>
>
> > Hi,
> >
> > I'm trying to override the treeview wndproc to catch some messages. For
> > other controls it worked fine, but with this one it crashes as soon as I
> > call the old wndproc. So it looks like this:
> >
> > mHWnd = IceCore::CreateWindowEx(
> >    WS_EX_CLIENTEDGE,
> >    WC_TREEVIEW,
> >    "",
> >    dwStyle,
> >    desc.mX, desc.mY,
> >    desc.mWidth, desc.mHeight,
> >    hwndParent,
> >    (HMENU)desc.mID,
> >    (HINSTANCE)GetModuleHandle(null),
> >    null
> >    );
> >
> >
> > And then to override the wndproc:
> >
> > typedef LRESULT (CALLBACK * WndProc_t)(HWND hwnd, UINT uMessage, WPARAM
> > wParam, LPARAM lParam);
> >
> > static WndProc_t OldWndProc = 0;
> >
> > OldWndProc = (WndProc_t) SetWindowLong(mHWnd, GWL_WNDPROC,
> > (LONG)MyTreeViewWndProc);
> >
> >
> > The new wndproc is simply calling the old one at the moment:
> >
> > static LRESULT CALLBACK MyTreeViewWndProc(HWND hwnd, UINT uMessage,
WPARAM
> > wParam, LPARAM lParam)
> > {
> >    return (OldWndProc)(hwnd, uMessage, wParam, lParam);
> > }
> >
> > ==> this crashes inside the old wndproc somewhere. However this same
> > procedure worked fine for other controls (list boxes, edit boxes....) so
> > I'm
> > not sure what's going on.
> >
> > Is there something special about the treeview's wndproc?
> >
> > Thanks,
> > - Pierre
> >
> >
>
> -------------------------------------------------------------------------
> > This SF.net email is sponsored by DB2 Express
> > Download DB2 Express C - the FREE version of DB2 express and take
> > control of your XML. No limits. Just data. Click to get it now.
> > http://sourceforge.net/powerbar/db2/
> > _______________________________________________
> > Gamedevlists-windows mailing list
> > [email protected]
> > https://lists.sourceforge.net/lists/listinfo/gamedevlists-windows
> > Archives:
> > http://sourceforge.net/mailarchive/forum.php?forum_id=555
> >
>
>
> -------------------------------------------------------------------------
> This SF.net email is sponsored by DB2 Express
> Download DB2 Express C - the FREE version of DB2 express and take
> control of your XML. No limits. Just data. Click to get it now.
> http://sourceforge.net/powerbar/db2/
> _______________________________________________
> Gamedevlists-windows mailing list
> [email protected]
> https://lists.sourceforge.net/lists/listinfo/gamedevlists-windows
> Archives:
> http://sourceforge.net/mailarchive/forum.php?forum_id=555
>


-------------------------------------------------------------------------
This SF.net email is sponsored by DB2 Express
Download DB2 Express C - the FREE version of DB2 express and take
control of your XML. No limits. Just data. Click to get it now.
http://sourceforge.net/powerbar/db2/
_______________________________________________
Gamedevlists-windows mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/gamedevlists-windows
Archives:
http://sourceforge.net/mailarchive/forum.php?forum_id=555