$OPTIMIZE ON $TYPECHECK ON $INCLUDE "rapidq.inc" $ESCAPECHARS ON RANDOMIZE TIMER DECLARE SUB ButtonWOL_OnClick DECLARE SUB ButtonWL_OnClick DECLARE SUB ButtonNS_OnClick DECLARE SUB Populate(lb AS QLISTBOX) DECLARE SUB Wait(show AS INTEGER) DECLARE FUNCTION LockWindowUpdate LIB "user32" ALIAS "LockWindowUpdate" (hwnd AS LONG) AS LONG 'DECLARE FUNCTION SetWindowLong Lib "user32" Alias "SetWindowLongA" (hwnd AS LONG, nIndex AS LONG, dwNewLong AS LONG) AS LONG CREATE Form AS QFORM Caption = "LockWindow Test" Height = 200 Width = 350 Center CREATE ListBox AS QLISTBOX Top = 5 Left = 5 Width = Form.ClientWidth - ListBox.Left - 5 Height = Form.ClientHeight - ListBox.Top - 30 ' 25 = height of button, 5 = offset END CREATE CREATE ButtonWOL AS QBUTTON Caption = "Add w/&o Lock" Top = ListBox.Height + 5 Left = 5 Width = 95 Height = 25 OnClick = ButtonWOL_OnClick END CREATE CREATE ButtonWL AS QBUTTON Caption = "Add w/ &Lock" Top = ListBox.Height + 5 Left = 105 '5 + 95 + 5 (offset + button + offset) Width = 95 Height = 25 OnClick = ButtonWL_OnClick END CREATE CREATE ButtonNS AS QBUTTON Caption = "Add w/ &No Show" Top = ListBox.Height + 5 Left = 205 '5 + 95 + 5 + 95 + 5(offset + button + offset + button + offset) Width = 95 Height = 25 OnClick = ButtonNS_OnClick END CREATE END CREATE Application.Title = Form.Caption Form.ShowModal SUB ButtonWOL_OnClick DIM begin AS LONG, the_end Wait(false) begin = TIMER ListBox.Clear Populate(ListBox) the_end = TIMER PRINT "Update w/o Lock" PRINT "Begin:\t" + STR$(begin) PRINT "End:\t" + STR$(the_end) PRINT "Taken:\t" + STR$(the_end - begin) PRINT Wait(True) END SUB SUB ButtonWL_OnClick DIM begin AS LONG, the_end Wait(false) begin = TIMER ListBox.Clear LockWindowUpdate(Form.Handle) Populate(ListBox) LockWindowUpdate(0) the_end = TIMER PRINT "Update w/ Lock" PRINT "Begin:\t" + STR$(begin) PRINT "End:\t" + STR$(the_end) PRINT "Taken:\t" + STR$(the_end - begin) PRINT Wait(True) END SUB SUB ButtonNS_OnClick DIM begin AS LONG, the_end Wait(false) begin = TIMER ListBox.Visible = False ListBox.Clear Populate(ListBox) ListBox.Visible = True the_end = TIMER PRINT "Update w/ Lock" PRINT "Begin:\t" + STR$(begin) PRINT "End:\t" + STR$(the_end) PRINT "Taken:\t" + STR$(the_end - begin) PRINT Wait(True) END SUB SUB Populate(lb AS QLISTBOX) DIM i AS INTEGER FOR i = 0 TO 25000 lb.AddItems STR$(RND) NEXT i END SUB SUB Wait(show AS INTEGER) IF show = True THEN ButtonWOL.Caption = "Add w/&o Lock" ButtonWL.Caption = "Add w/ &Lock" ButtonNS.Caption = "Add w/ &No Show" ButtonWOL.Enabled = True ButtonWL.Enabled = True ButtonNS.Enabled = True ELSEIF show = False THEN ButtonWOL.Caption = "Wait..." ButtonWL.Caption = "Wait..." ButtonNS.Caption = "Wait..." ButtonWOL.Enabled = False ButtonWL.Enabled = False ButtonNS.Enabled = False ELSE PRINT "Really bad error!" END END IF END SUB