下面是我从自己的程序里抠下来的,GUI你自己添加一下吧Func MY_WM_COMMAND($hWnd, $msg, $wParam, $lParam)
Local $nNotifyCode = _HiWord($wParam)
Local $nID = _LoWord($wParam)
Switch $nID
Case $filter ; input控件句柄
Switch $nNotifyCode
Case $EN_CHANGE
_FilterItem(GUICtrlRead($filter))
EndSwitch
EndSwitch
Return $GUI_RUNDEFMSG
EndFunc ;==>MY_WM_COMMAND
Func _HiWord($x)
Return BitShift($x, 16)
EndFunc ;==>_HiWord
Func _LoWord($x)
Return BitAND($x, 0xFFFF)
EndFunc ;==>_LoWord
Func _FilterItem($keyword)
If $aLVItems[0] = 0 Then Return
If $keyword Then ;用户输入过滤关键词
Local $aNewFilter[1] = [0]
For $i = 1 To $aLVItems[0]
If StringInStr($aLVItems[$i], $keyword) Then ; 暂存符合条件得项目
$aNewFilter[0] += 1
ReDim $aNewFilter[$aNewFilter[0] + 1]
$aNewFilter[$aNewFilter[0]] = $aLVItems[$i]
EndIf
Next
_GUICtrlListView_DeleteAllItems($hListView) ;ListView控件句柄
If $aNewFilter[0] = 0 Then Return
For $i = 1 To $aNewFilter[0]
GUICtrlCreateListViewItem($aNewFilter[$i], $hListView)
Next
$aNewFilter = ''
Else
_GUICtrlListView_DeleteAllItems($hListView)
For $i = 1 To $aLVItems[0]
GUICtrlCreateListViewItem($aLVItems[$i], $hListView)
Next
EndIf
EndFunc ;==>_FilterItem
|