Crash when overriding tree view wndproc

"Pierre Terdiman" <[email protected]> Wed, 4 Jul 2007 15:23:13 +0200
Newsgroups gmane.games.devel.windows
Message-ID <[email protected]>
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