winapi - subclassing child window c++ -
i working on windows , chose c++ language. application win32 application , not using mfc classes, native api.
my main window contain tab control in there listview control. tried subclass both control, not working though follow msdn guide.
the function used are: setwindowlong
, getwindowlong
changed child's procedures seems main window catches every messages controls send ( through wm_notify ) , every wm messages. thought may concern focus not have idea on how implement kind of situation: child control parent of child control.
i have created tab control in way. code:
hwndtab = createwindow(wc_tabcontrol, "", ws_child | ws_clipsiblings | ws_visible, 0, 0, rcclient.right, rcclient.bottom, winhandle, null, hinst, null); oldusertabproc = (wndproc)getwindowlong(hwndtab, gwl_wndproc); setwindowlong(hwndtab, gwl_wndproc, (long_ptr)usertabproc);
here tab control procedure
lresult callback usertabproc( hwnd hwnd, uint message, wparam wparam, lparam lparam ) { switch ( message ) { case wm_lbuttondown: break; case wm_rbuttonup: break; case tcn_selchange: { usercurrenttab = tabctrl_getcursel( usertab ); break; } case tcn_selchanging: { break; } }; return callwindowproc( oldusertabproc, hwnd, message, wparam, lparam ); }
the listview has parent tab control.
values tcn_selchange
not message types , aren't sent control themselves. notifications (the n
stands "notification"). notifications sent control parent using message wm_notify
or wm_command
. cannot intercept them subclassing control.
if want change way parent handles notifications, need subclass parent.
Comments
Post a Comment