Python win32con 模块,LBN_SELCHANGE 实例源码

我们从Python开源项目中,提取了以下17个代码示例,用于说明如何使用win32con.LBN_SELCHANGE

项目:Automation-Framework-for-devices    作者:tok-gogogo    | 项目源码 | 文件源码
def selectListboxItem(hwnd, item):
    '''Selects a specified item in a list box control.

    Arguments:
    hwnd            Window handle of the required list box.
    item            The reqired item. Either an index, of the text of the
                    required item.

    Usage example:  TODO
    '''
    try: # item is an index Use this to select
        0 + item
        win32gui.SendMessage(hwnd, win32con.LB_SETCURSEL, item, 0)
        _sendNotifyMessage(hwnd, win32con.LBN_SELCHANGE)
    except TypeError: # Item is a string - find the index, and use that
        items = getListboxItems(hwnd)
        itemIndex = items.index(item)
        selectListboxItem(hwnd, itemIndex)
项目:Automation-Framework-for-devices    作者:tok-gogogo    | 项目源码 | 文件源码
def selectListboxItem(hwnd, item):
    '''Selects a specified item in a list box control.

    Arguments:
    hwnd            Window handle of the required list box.
    item            The reqired item. Either an index, of the text of the
                    required item.

    Usage example:  TODO
    '''
    try: # item is an index Use this to select
        0 + item
        win32gui.SendMessage(hwnd, win32con.LB_SETCURSEL, item, 0)
        _sendNotifyMessage(hwnd, win32con.LBN_SELCHANGE)
    except TypeError: # Item is a string - find the index, and use that
        items = getListboxItems(hwnd)
        itemIndex = items.index(item)
        selectListboxItem(hwnd, itemIndex)
项目:Automation-Framework-for-devices    作者:tok-gogogo    | 项目源码 | 文件源码
def selectListboxItem(hwnd, item):
    '''Selects a specified item in a list box control.

    Arguments:
    hwnd            Window handle of the required list box.
    item            The reqired item. Either an index, of the text of the
                    required item.

    Usage example:  TODO
    '''
    try: # item is an index Use this to select
        0 + item
        win32gui.SendMessage(hwnd, win32con.LB_SETCURSEL, item, 0)
        _sendNotifyMessage(hwnd, win32con.LBN_SELCHANGE)
    except TypeError: # Item is a string - find the index, and use that
        items = getListboxItems(hwnd)
        itemIndex = items.index(item)
        selectListboxItem(hwnd, itemIndex)
项目:OSPTF    作者:xSploited    | 项目源码 | 文件源码
def CmdTypeListbox(self, id, code):
        if code == win32con.LBN_SELCHANGE:
            pos = self.typelb.GetCurSel()
            if pos >= 0:
                self.memberlb.ResetContent()
                self.typeinfo = self.tlb.GetTypeInfo(pos)
                self.attr = self.typeinfo.GetTypeAttr()
                for i in range(self.attr[7]):
                    id = self.typeinfo.GetVarDesc(i)[0]
                    self.memberlb.AddString(self.typeinfo.GetNames(id)[0])
                for i in range(self.attr[6]):
                    id = self.typeinfo.GetFuncDesc(i)[0]
                    self.memberlb.AddString(self.typeinfo.GetNames(id)[0])
                self.SetupAllInfoTypes()
            return 1
项目:OSPTF    作者:xSploited    | 项目源码 | 文件源码
def CmdMemberListbox(self, id, code):
        if code == win32con.LBN_SELCHANGE:
            self.paramlb.ResetContent()
            pos = self.memberlb.GetCurSel()
            realPos, isMethod = self._GetRealMemberPos(pos)
            if isMethod:
                id = self.typeinfo.GetFuncDesc(realPos)[0]
                names = self.typeinfo.GetNames(id)
                for i in range(len(names)):
                    if i > 0:
                        self.paramlb.AddString(names[i])
            self.SetupAllInfoTypes()
            return 1
项目:pupy    作者:ru-faraon    | 项目源码 | 文件源码
def CmdTypeListbox(self, id, code):
        if code == win32con.LBN_SELCHANGE:
            pos = self.typelb.GetCurSel()
            if pos >= 0:
                self.memberlb.ResetContent()
                self.typeinfo = self.tlb.GetTypeInfo(pos)
                self.attr = self.typeinfo.GetTypeAttr()
                for i in range(self.attr[7]):
                    id = self.typeinfo.GetVarDesc(i)[0]
                    self.memberlb.AddString(self.typeinfo.GetNames(id)[0])
                for i in range(self.attr[6]):
                    id = self.typeinfo.GetFuncDesc(i)[0]
                    self.memberlb.AddString(self.typeinfo.GetNames(id)[0])
                self.SetupAllInfoTypes()
            return 1
项目:pupy    作者:ru-faraon    | 项目源码 | 文件源码
def CmdMemberListbox(self, id, code):
        if code == win32con.LBN_SELCHANGE:
            self.paramlb.ResetContent()
            pos = self.memberlb.GetCurSel()
            realPos, isMethod = self._GetRealMemberPos(pos)
            if isMethod:
                id = self.typeinfo.GetFuncDesc(realPos)[0]
                names = self.typeinfo.GetNames(id)
                for i in range(len(names)):
                    if i > 0:
                        self.paramlb.AddString(names[i])
            self.SetupAllInfoTypes()
            return 1
项目:remoteControlPPT    作者:htwenning    | 项目源码 | 文件源码
def ReloadData(self):
        service = self.GetSelService()
        self.listCtrl.SetRedraw(0)
        self.listCtrl.ResetContent()
        svcs = win32service.EnumServicesStatus(self.scm)
        i = 0
        self.data = []
        for svc in svcs:
            try:
                status = ('Unknown', 'Stopped', 'Starting', 'Stopping', 'Running',
                    'Continuing', 'Pausing', 'Paused')[svc[2][1]]
            except:
                status = 'Unknown'
            s = win32service.OpenService(self.scm, svc[0], win32service.SERVICE_ALL_ACCESS)
            cfg = win32service.QueryServiceConfig(s)
            try:
                startup = ('Boot', 'System', 'Automatic', 'Manual', 'Disabled')[cfg[1]]
            except:
                startup = 'Unknown'
            win32service.CloseServiceHandle(s)

            # svc[2][2] control buttons
            pos = self.listCtrl.AddString(str(svc[1]) + '\t' + status + '\t' + startup)
            self.listCtrl.SetItemData(pos, i)
            self.data.append(tuple(svc[2]) + (svc[1], svc[0], ))
            i = i + 1

            if service and service[1] == svc[0]:
                self.listCtrl.SetCurSel(pos)
        self.OnListEvent(self.IDC_LIST, win32con.LBN_SELCHANGE)
        self.listCtrl.SetRedraw(1)
项目:remoteControlPPT    作者:htwenning    | 项目源码 | 文件源码
def OnListEvent(self, id, code):
        if code == win32con.LBN_SELCHANGE or code == win32con.LBN_SELCANCEL:
            pos = self.listCtrl.GetCurSel()
            if pos >= 0:
                data = self.data[self.listCtrl.GetItemData(pos)][2]
                canstart = (self.data[self.listCtrl.GetItemData(pos)][1] == win32service.SERVICE_STOPPED)
            else:
                data = 0
                canstart = 0
            self.GetDlgItem(self.IDC_START).EnableWindow(canstart)
            self.GetDlgItem(self.IDC_STOP).EnableWindow(data & win32service.SERVICE_ACCEPT_STOP)
            self.GetDlgItem(self.IDC_PAUSE).EnableWindow(data & win32service.SERVICE_ACCEPT_PAUSE_CONTINUE)
            self.GetDlgItem(self.IDC_CONTINUE).EnableWindow(data & win32service.SERVICE_ACCEPT_PAUSE_CONTINUE)
项目:remoteControlPPT    作者:htwenning    | 项目源码 | 文件源码
def OnListCommand(self, id, code):
        if code==win32con.LBN_SELCHANGE:
            style = self.GetSelectedStyle()
            self.UpdateUIForStyle(style)
        return 1
项目:remoteControlPPT    作者:htwenning    | 项目源码 | 文件源码
def CmdTypeListbox(self, id, code):
        if code == win32con.LBN_SELCHANGE:
            pos = self.typelb.GetCurSel()
            if pos >= 0:
                self.memberlb.ResetContent()
                self.typeinfo = self.tlb.GetTypeInfo(pos)
                self.attr = self.typeinfo.GetTypeAttr()
                for i in range(self.attr[7]):
                    id = self.typeinfo.GetVarDesc(i)[0]
                    self.memberlb.AddString(self.typeinfo.GetNames(id)[0])
                for i in range(self.attr[6]):
                    id = self.typeinfo.GetFuncDesc(i)[0]
                    self.memberlb.AddString(self.typeinfo.GetNames(id)[0])
                self.SetupAllInfoTypes()
            return 1
项目:remoteControlPPT    作者:htwenning    | 项目源码 | 文件源码
def CmdMemberListbox(self, id, code):
        if code == win32con.LBN_SELCHANGE:
            self.paramlb.ResetContent()
            pos = self.memberlb.GetCurSel()
            realPos, isMethod = self._GetRealMemberPos(pos)
            if isMethod:
                id = self.typeinfo.GetFuncDesc(realPos)[0]
                names = self.typeinfo.GetNames(id)
                for i in range(len(names)):
                    if i > 0:
                        self.paramlb.AddString(names[i])
            self.SetupAllInfoTypes()
            return 1
项目:CodeReader    作者:jasonrbr    | 项目源码 | 文件源码
def OnListCommand(self, id, code):
        if code==win32con.LBN_SELCHANGE:
            style = self.GetSelectedStyle()
            self.UpdateUIForStyle(style)
        return 1
项目:CodeReader    作者:jasonrbr    | 项目源码 | 文件源码
def ReloadData(self):
        service = self.GetSelService()
        self.listCtrl.SetRedraw(0)
        self.listCtrl.ResetContent()
        svcs = win32service.EnumServicesStatus(self.scm)
        i = 0
        self.data = []
        for svc in svcs:
            try:
                status = ('Unknown', 'Stopped', 'Starting', 'Stopping', 'Running',
                    'Continuing', 'Pausing', 'Paused')[svc[2][1]]
            except:
                status = 'Unknown'
            s = win32service.OpenService(self.scm, svc[0], win32service.SERVICE_ALL_ACCESS)
            cfg = win32service.QueryServiceConfig(s)
            try:
                startup = ('Boot', 'System', 'Automatic', 'Manual', 'Disabled')[cfg[1]]
            except:
                startup = 'Unknown'
            win32service.CloseServiceHandle(s)

            # svc[2][2] control buttons
            pos = self.listCtrl.AddString(str(svc[1]) + '\t' + status + '\t' + startup)
            self.listCtrl.SetItemData(pos, i)
            self.data.append(tuple(svc[2]) + (svc[1], svc[0], ))
            i = i + 1

            if service and service[1] == svc[0]:
                self.listCtrl.SetCurSel(pos)
        self.OnListEvent(self.IDC_LIST, win32con.LBN_SELCHANGE)
        self.listCtrl.SetRedraw(1)
项目:CodeReader    作者:jasonrbr    | 项目源码 | 文件源码
def OnListEvent(self, id, code):
        if code == win32con.LBN_SELCHANGE or code == win32con.LBN_SELCANCEL:
            pos = self.listCtrl.GetCurSel()
            if pos >= 0:
                data = self.data[self.listCtrl.GetItemData(pos)][2]
                canstart = (self.data[self.listCtrl.GetItemData(pos)][1] == win32service.SERVICE_STOPPED)
            else:
                data = 0
                canstart = 0
            self.GetDlgItem(self.IDC_START).EnableWindow(canstart)
            self.GetDlgItem(self.IDC_STOP).EnableWindow(data & win32service.SERVICE_ACCEPT_STOP)
            self.GetDlgItem(self.IDC_PAUSE).EnableWindow(data & win32service.SERVICE_ACCEPT_PAUSE_CONTINUE)
            self.GetDlgItem(self.IDC_CONTINUE).EnableWindow(data & win32service.SERVICE_ACCEPT_PAUSE_CONTINUE)
项目:CodeReader    作者:jasonrbr    | 项目源码 | 文件源码
def CmdTypeListbox(self, id, code):
        if code == win32con.LBN_SELCHANGE:
            pos = self.typelb.GetCurSel()
            if pos >= 0:
                self.memberlb.ResetContent()
                self.typeinfo = self.tlb.GetTypeInfo(pos)
                self.attr = self.typeinfo.GetTypeAttr()
                for i in range(self.attr[7]):
                    id = self.typeinfo.GetVarDesc(i)[0]
                    self.memberlb.AddString(self.typeinfo.GetNames(id)[0])
                for i in range(self.attr[6]):
                    id = self.typeinfo.GetFuncDesc(i)[0]
                    self.memberlb.AddString(self.typeinfo.GetNames(id)[0])
                self.SetupAllInfoTypes()
            return 1
项目:CodeReader    作者:jasonrbr    | 项目源码 | 文件源码
def CmdMemberListbox(self, id, code):
        if code == win32con.LBN_SELCHANGE:
            self.paramlb.ResetContent()
            pos = self.memberlb.GetCurSel()
            realPos, isMethod = self._GetRealMemberPos(pos)
            if isMethod:
                id = self.typeinfo.GetFuncDesc(realPos)[0]
                names = self.typeinfo.GetNames(id)
                for i in range(len(names)):
                    if i > 0:
                        self.paramlb.AddString(names[i])
            self.SetupAllInfoTypes()
            return 1