Re: [GD-Windows] Crash when overriding tree view wndproc
Brought to you by:
vexxed72
|
From: Roman K. <Rom...@Pi...> - 2007-07-04 13:31:06
|
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" <pte...@ag...>
To: "Game Development for MS Windows"
<gam...@li...>
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
> Gam...@li...
> https://lists.sourceforge.net/lists/listinfo/gamedevlists-windows
> Archives:
> http://sourceforge.net/mailarchive/forum.php?forum_id=555
>
|