|
-
Jul 9th, 2002, 07:26 AM
#1
LockWindowUpdate API Problem...
OK, I am using the following...
VB Code:
Private Declare Function LockWindowUpdate Lib "user32" Alias "LockWindowUpdate" (ByVal hwndLock As Long) As Long
Private Sub LoadData
ListView1.ListItems.Clear
DoEvents
LockWindowUpdate ListView1.hWnd
'Load data code, to big and irrelavant to post here :D
LockWindowUpdate False
End Sub
Now this works fine. The ListView does not update till all items have been added, which speeds the application up. This is what I want...HOWEVER, if while loading I select another form, which makes it active, from the same application the ListView becomes "UnLocked"! And the user can see the items being added! 
How can I get around this?
Wokawooooo
I understand that you can lock only one window at a time, but the only window I lock in my app is the ListView. Why does it get "Unlocked"...???
-
Jul 9th, 2002, 07:38 AM
#2
Oh large sloppy poo on a very big stick!
After further investigation, it only requires a user to select any other application, related or not, and the ListView becomes unlocked! Arrrrrr.....bugger! 
akoW
-
Dec 3rd, 2019, 09:53 PM
#3
Re: LockWindowUpdate API Problem...
Old post, but my solution with grids /combos is to make them invisible and then visible again at the end of the loading function
-
Dec 4th, 2019, 04:13 AM
#4
Re: LockWindowUpdate API Problem...
 Originally Posted by shagratt
Old post, but my solution with grids /combos is to make them invisible and then visible again at the end of the loading function
Making a control invisible forces it to lose focus. You can try using WM_SETREDRAW to suppress redraws instead:
Code:
Private Const WM_SETREDRAW As Long = &HB
Private Declare Function SendMessage Lib "user32" Alias "SendMessageA" (ByVal hWnd As Long, ByVal wMsg As Long, ByVal wParam As Long, lParam As Any) As Long
Property Let HwndRedraw(ByVal hWnd As Long, ByVal bValue As Boolean)
Call SendMessage(hWnd, WM_SETREDRAW, -bValue, ByVal 0)
End Property
cheers,
</wqw>
-
Dec 17th, 2019, 04:12 PM
#5
PowerPoster
Re: LockWindowUpdate API Problem...
 Originally Posted by wqweto
Making a control invisible forces it to lose focus. You can try using WM_SETREDRAW to suppress redraws instead:
Code:
Private Const WM_SETREDRAW As Long = &HB
Private Declare Function SendMessage Lib "user32" Alias "SendMessageA" (ByVal hWnd As Long, ByVal wMsg As Long, ByVal wParam As Long, lParam As Any) As Long
Property Let HwndRedraw(ByVal hWnd As Long, ByVal bValue As Boolean)
Call SendMessage(hWnd, WM_SETREDRAW, -bValue, ByVal 0)
End Property
cheers,
</wqw>
HI BRO!
I have no idea to use your tips...
can you post a simple whe the listview is filled?
Tks.
-
Dec 17th, 2019, 08:46 PM
#6
Re: LockWindowUpdate API Problem...
Private Declare Function RedrawWindow _
Lib "user32.dll" (ByVal hWnd As Long, _
ByVal lprcUpdate As Long, _
ByVal hrgnUpdate As Long, _
ByVal fuRedraw As Long) As Long
Private Sub LoadData
ListView1.ListItems.Clear
DoEvents
Call FreezeWindow (ListView1.hWnd, True)
'Load data code, to big and irrelavant to post here
Call FreezeWindow (ListView1.hWnd, False)
End Sub
Code:
Private Sub FreezeWindow(ByVal hWnd As Long, Optional ByVal boolAction As Boolean = True)
Const WM_SETREDRAW As Long = &HB&
Const RDW_ALLCHILDREN As Long = &H80
Const RDW_INVALIDATE As Long = &H1
If boolAction = True Then
SendMessage hWnd, WM_SETREDRAW, False, 0&
Else
SendMessage hWnd, WM_SETREDRAW, True, 0&
RedrawWindow hWnd, ByVal 0&, 0&, RDW_INVALIDATE Or RDW_ALLCHILDREN
End If
End Sub
Last edited by Episcopal; Dec 17th, 2019 at 08:52 PM.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|