0.VC(ui)-hook-Combox滚动条

来源:互联网 发布:js 二维数组赋值 编辑:程序博客网 时间:2024/05/17 22:06

How do I subclass the listbox portion of a combobox? The listbox portion of a combobox is of type COMBOLBOX (notice the "L "). Because the ComboLBox window is not a child of the ComboBox window, it is not obvious how to subclass the COMBOLBOX control. Luckily,under the Win32 API, Windows sends a message to the COMBOBOX (notice no "L ") called WM_CTLCOLORLISTBOX before the listbox is drawn. The lParam passed with this message contains the handle of   the list box

明白了,可以用枚举线程窗口的方法得到COMBOLBOX这个类的窗口的指针,然后hook它,就挂上滚动条了,因为它不是ComboBox的子窗口,当然不能枚举子窗口了,还有一种方法就是在ComboBox中处理WM_CTLCOLORLISTBOX消息,lparam就是它了,然后hook它,直接hook ComboBox是无效的。

BOOL GetComboBoxInfo(          HWND hwndCombo,    PCOMBOBOXINFO pcbi);
typedef struct tagCOMBOBOXINFO {    DWORD cbSize;    RECT rcItem;    RECT rcButton;    DWORD stateButton;    HWND hwndCombo;    HWND hwndItem;    HWND hwndList;//hwndList就是COMBOLBOX的hwnd} COMBOBOXINFO, *PCOMBOBOXINFO, *LPCOMBOBOXINFO;



原创粉丝点击