[GD-Windows] Crash when overriding tree view wndproc
Brought to you by:
vexxed72
From: Pierre T. <pte...@ag...> - 2007-07-04 13:22:24
|
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 |