StungStang Posted April 10, 2011 Author Posted April 10, 2011 (edited) Considering the fact that you can populate a listview with 7000 rows in WELL under .1 second by looping through an array, just exactly how much faster do you need it to be? Of course i need the much speed as possible. I'm writing a search engine, when you can search your favorite radio from my huge database. My search is like that "Google Instant" that shows results as you type. You can watch it here : expandcollapse popup#include <ComboConstants.au3> #include <GUIConstantsEx.au3> #include <ListViewConstants.au3> #include <WindowsConstants.au3> #include <GuiListView.au3> #include <GUIComboBox.au3> #include <SQLite.au3> #include <SQLite.dll.au3> $hGUI = GUICreate("Let's try", 477, 191, 192, 124) $hComboBox = _GUICtrlComboBox_Create($hGUI,"", 8, 8, 145, 25) $hListView = GUICtrlCreateListView("Name|Stream|Web|Genre|State", 0, 40, 474, 150) GUISetState(@SW_SHOW) Local $fComboChange = False ; Set flag for search form GUIRegisterMsg($WM_NOTIFY, "_WM_NOTIFY") GUIRegisterMsg($WM_COMMAND, "_WM_COMMAND") AdlibRegister("_Search", 200) _SQLite_Startup("YourDataBase") _SQLite_Open() While 1 $nMsg = GUIGetMsg() Switch $nMsg Case $GUI_EVENT_CLOSE Exit EndSwitch WEnd Func _Search() If $fComboChange Then $TimerInt = TimerInit() $fComboChange = False $sText = _GUICtrlComboBox_GetEditText($hComboBox) If $sText <> "" Then _UpdateListView($sText) Else _GUICtrlListView_DeleteAllItems($hListView) EndIf EndIf EndFunc ;==>_Search Func _UpdateListView($sText) Local $aResult, $iRows, $iColumns _GUICtrlListView_BeginUpdate($hListView) _GUICtrlListView_DeleteAllItems($hListView) Local $hQuery, $aRow, $aNames $iRval = _SQLite_GetTable2d(-1, "SELECT * FROM Data WHERE Radio LIKE '%" & $sText & "%';", $aResult, $iRows, $iColumns) _ArrayDelete($aResult, 0) If $iRval = $SQLITE_OK Then _GUICtrlListView_AddArray($hListView, $aResult) _GUICtrlListView_EndUpdate($hListView) EndFunc ;==>_UpdateListView Func _WM_COMMAND($hWnd, $iMsg, $iwParam, $ilParam) $hWndFrom = $ilParam $iIDFrom = BitAND($iwParam, 0xFFFF) $iCode = BitShift($iwParam, 16) Switch $hWndFrom Case $hComboBox Switch $iCode Case $CBN_EDITCHANGE Sleep(1000) $fComboChange = True EndSwitch EndSwitch Return $GUI_RUNDEFMSG EndFunc ;==>_WM_COMMAND Func _WM_NOTIFY($hWnd, $iMsg, $iwParam, $ilParam) #forceref $hWnd, $iMsg, $iwParam Local $I Global $hWndFrom, $iCode, $tNMHDR, $hWndListView, $lParam $hWndListView = $ListView $hWnd1 = $hGUI If Not IsHWnd($ListView) Then $hWndListView = GUICtrlGetHandle($ListView) $tNMHDR = DllStructCreate($tagNMHDR, $ilParam) $hWndFrom = HWnd(DllStructGetData($tNMHDR, "hWndFrom")) $iCode = DllStructGetData($tNMHDR, "Code") Switch $hWndFrom Case $hWndListView Switch $iCode Case $LVN_ITEMACTIVATE Local $nmia = DllStructCreate($tagNMITEMACTIVATE, $ilParam) $I = DllStructGetData($nmia, "Index") $SomeVariablex = _GUICtrlListView_GetItemTextArray($ListView, $I) ; Grab Info ;With $SomeVariablex[2] i grab the streaming link and i reproduce it with Bass.dll Global $SomeVariablex[2] EndSwitch EndSwitch Return $__LISTVIEWCONSTANT_GUI_RUNDEFMSG EndFunc ;==>_WM_NOTIFY I want just simply make as fast as possible the search form Hi! Edited April 10, 2011 by StungStang
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now