Search the Community
Showing results for tags 'buffer'.
-
I got an example from LarsJ's Virtual listviews Virtual listviews Data stored in databases This is very cool code But when I press the scroll next to The program only buffers one data at a time I think this will cause the SERVER to be too busy I want to change into a buffer of 100 items Can someone help me?? database Test3.rar #include <GUIConstants.au3> #include <WindowsConstants.au3> #include <GuiListView.au3> #include <SQLite.au3> ;Opt( "MustDeclareVars", 1 ) Global Const $tagNMLVCACHEHINT = $tagNMHDR & ";int iFrom;int iTo" Global $hLV,$conn Example() Func Example() _SQLite_Startup() ; Check databases Local $iRows3 = CheckDB( "Test3.db" ) Local $iRows ; Create GUI GUICreate( "Virtual ListViews", 850, 400 ) ; Create Tab Local $idTab = GUICtrlCreateTab( 10, 10, 850-20, 400-20 ) GUICtrlCreateTabItem( "Test3.db: " & Format( $iRows3 ) & " rows" ) GUICtrlCreateTabItem( "" ) ; Create ListView Local $idLV = GUICtrlCreateListView( "", 20, 40, 850-40, 400-50, $LVS_OWNERDATA, BitOR( $WS_EX_CLIENTEDGE, $LVS_EX_DOUBLEBUFFER, $LVS_EX_FULLROWSELECT ) ) $hLV = GUICtrlGetHandle( $idLV ) ; Virtual listview Reduces flicker For $i = 0 To 9 _GUICtrlListView_AddColumn( $hLV, "Col" & $i, 75 ) Next GUIRegisterMsg( $WM_NOTIFY, "WM_NOTIFY" ) GUISetState( @SW_SHOW ) ; Data for first tab $iRows = $iRows3 If $iRows Then _SQLite_Open( "Test3.db" ) GUICtrlSendMsg( $idLV, $LVM_SETITEMCOUNT, $iRows, 0 ) ; Message loop While 1 Switch GUIGetMsg() Case $idTab If $iRows Then _SQLite_Close( -1 ) Switch GUICtrlRead( $idTab ) Case 0 $iRows = $iRows1 If $iRows Then _SQLite_Open( "Test1.db" ) Case 1 $iRows = $iRows2 If $iRows Then _SQLite_Open( "Test2.db" ) Case 2 $iRows = $iRows3 If $iRows Then _SQLite_Open( "Test3.db" ) EndSwitch GUICtrlSendMsg( $idLV, $LVM_SETITEMCOUNT, $iRows, 0 ) Case $GUI_EVENT_CLOSE ExitLoop EndSwitch WEnd If $iRows Then _SQLite_Close( -1 ) _SQLite_Shutdown() GUIDelete() EndFunc Func WM_NOTIFY( $hWnd, $iMsg, $wParam, $lParam ) Local Static $tText = DllStructCreate( "wchar[50]" ) Local Static $pText = DllStructGetPtr( $tText ) Local Static $aResult, $iRows, $iFrom Local $tNMHDR, $hWndFrom, $iCode $tNMHDR = DllStructCreate( $tagNMHDR, $lParam ) $hWndFrom = HWnd( DllStructGetData( $tNMHDR, "hWndFrom" ) ) $iCode = DllStructGetData( $tNMHDR, "Code" ) Switch $hWndFrom Case $hLV Switch $iCode Case $LVN_GETDISPINFOW Local $tNMLVDISPINFO = DllStructCreate( $tagNMLVDISPINFO, $lParam ) If BitAND( DllStructGetData( $tNMLVDISPINFO, "Mask" ), $LVIF_TEXT ) Then Local $iIndex = DllStructGetData( $tNMLVDISPINFO, "Item" ) - $iFrom + 1 If $iIndex > 0 And $iIndex < $iRows + 1 Then Local $sItem = $aResult[$iIndex][DllStructGetData($tNMLVDISPINFO,"SubItem")] DllStructSetData( $tText, 1, $sItem ) DllStructSetData( $tNMLVDISPINFO, "Text", $pText ) DllStructSetData( $tNMLVDISPINFO, "TextMax", StringLen( $sItem ) ) EndIf EndIf Case $LVN_ODCACHEHINT Local $tNMLVCACHEHINT = DllStructCreate( $tagNMLVCACHEHINT, $lParam ), $iColumns $iFrom = DllStructGetData( $tNMLVCACHEHINT, "iFrom" ) $iTo=DllStructGetData( $tNMLVCACHEHINT, "iTo" ) Local $sSQL = "SELECT * FROM lvdata WHERE item_id >= " & $iFrom & _ " AND item_id <= " & DllStructGetData( $tNMLVCACHEHINT, "iTo" ) & ";" ConsoleWrite($iFrom&" "&$iTo&@CRLF) _SQLite_GetTable2d( -1, $sSQL, $aResult, $iRows, $iColumns ) EndSwitch EndSwitch Return $GUI_RUNDEFMSG EndFunc Func CheckDB( $sDBname ) Local $aRow, $iRows = 0 If FileExists( $sDBname ) Then _SQLite_Open( $sDBname ) _SQLite_QuerySingleRow( -1, "SELECT max(item_id) FROM lvdata;", $aRow ) _SQLite_Close( -1 ) EndIf If IsArray( $aRow ) Then _ $iRows = $aRow[0] + 1 Return $iRows EndFunc Func Format( $iInt ) Return StringRegExpReplace( $iInt, "(\A\d{1,3}(?=(\d{3})+\z)|\d{3}(?=\d))", "\1," ) EndFunc
-
Opt("WinTitleMatchMode", 2) ControlClick("codebuffer1.au3", "Tab", 354, "left") ControlSend("codebuffer1.au3", "Tab", 354, "{F5}") So after using SciTE with AutoIT for a few months, I decided I'd like to test different buffer code while working on an included page on a different buffer. So send a control click to Scite to click then send F5? I was thinking it would work but it does not for me. Using the finder tool it appears the tab is Control ID 354 and with WinTitleMatchMode set to '2' I was expecting results... Can anyone show me the error of my ways?
-
Hello AutoIt community, I'm working on a project where I need to copy the bits of a file to a child process's StdIn stream. It's almost complete, but I have one final snag. The script uses DLLStructCreate to create a 64K buffer that holds the file's binary contents in memory. It iterates through the contents of the desired file in 64K segments, first pulling the bits into the buffer, then dumping the contents of the buffer out to the child process's StdIn stream. The child process then ultimately reconstitutes the file on a remote system. The child process does build the file in the target directory, but the problem is that the reconstituted file is always slightly larger than the original because it's always a multiple of 64K (when you look at the file properties, the size is always identical to the "size on disk" value). Storage consumption is not a concern since it's technically not occupying more space than the original, but file integrity is a concern. Not every file shows any signs of corruption when opening it, but some of the reconstituted files are completely useless because of this. I know that the problem lies within the last iteration of reading the source file; for example, if there are only 24K bits remaining to be read, that data gets stored in the DLLStruct along with 40K of zeros to fill the entire 64K buffer. When the file is reconstituted, this padding of zeroes is unfortunately also included. So my challenge is to try to figure out how to ignore these trailing zeroes while reading the final <64K bits of the file, or at least only send part of the contents of the DLLStruct buffer to StdIn. Does anyone know how to go about doing this? Thanks in advance, Jeemo
- 2 replies
-
- stdin
- dllstructgetdata
-
(and 3 more)
Tagged with:
-
I have a basic script that takes the mouse input on a button like so: Local $msg, $Button, $GUIhandle, $response = "" $GUIhandle = GUICreate("example", 680, 575) $Button = GUICtrlCreateButton("example", 260, 5, 30) While 1 $msg = GUIGetMsg() If $msg = $Button Then ExampleFunct() ExitLoop EndIf If $response <> "" Then msgbox(0, "", $response) EndIf Wend Func ExampleFunct() $response = "respond" EndFunc Yet, If I kill this program and start it up after hitting the button with the left click 2-3 times, I will start it again and it will click the button on its own (like its buffered).
-
Even by reading the Help file I still don't get it when exactly to apply this function, and what happens if I don't use it ? Thanks FileFlush()