• Combox滚动条hook


    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;

  • 相关阅读:
    [BZOJ 1001] [BeiJing2006]狼抓兔子
    [BZOJ 1070] [SCOI2007] 修车
    [BZOJ 1834] [ZJOI2010]network 网络扩容
    [POJ 2135] Farm Tour
    [CodeFights] Changu Circle
    [Noip模拟赛] Power
    [Noip模拟赛] Polygon
    【学习】计算几何初步
    【学习】序列DP
    [BZOJ 2659] [Beijing wc2012] 算不出的算式
  • 原文地址:https://www.cnblogs.com/hgy413/p/3693605.html
Copyright © 2020-2023  润新知