Advertisement
7_2009-2012 Miscellaneous #229227

Lock controls for fast updates

When you, for example, add listitems to a listbox or combo box Windows repaints the box after each addidtion. This takes up processing time, makes your app look bad (due to flickering) and if you add a lot of items it can take a long time(Especially if the Combo or Listbox Sorted properety is set to true) Windows provides an API called LockWindowUpdate that you can use to keep Windows from updating a control with a hWnd property. This code is a simple way to call that function.

AI

Shrnutí AI: This codebase represents a historical implementation of the logic described in the metadata. Our preservation engine analyzes the structure to provide context for modern developers.

Zdrojový kód
original-source
Public Sub LockControl(objX As Object, cLock As Boolean)
 Dim i As Long
 If cLock Then
  ' This will lock the control
  LockWindowUpdate objX.hWnd
 Else
  ' This will unlock controls
  LockWindowUpdate 0
  objX.Refresh
 End If
End sub
'-- End --'
Původní komentáře (3)
Obnoveno z Wayback Machine