-
How can I stop screen refreshing and start it again? Anyone???
I wrote a chess prog, and to check for checkmate/stalemate, it makes every legal move for the opponent until they aren't in check (or it declares game over).
Problem is, the screen is flashy while pieces rapidly move around screen. I want to turn this off while checking the position (which should also speed up processing), then turn on again when done.
I am using images for the pieces. Any helpful ideas would be GREATLY appreciated.
~seaweed
-
Could you maybe set the properties of the pieces to invisible?
-
Try the LockWindowUpdate() API, it prevents Drawing Operations in a Specified Window, ie.
Code:
Private Declare Function LockWindowUpdate Lib "user32" Alias "LockWindowUpdate" (ByVal hwndLock As Long) As Long
Private Sub Command1_Click()
'Stop Updating while performing the following operations
Call LockWindowUpdate(Hwnd)
'Put your Code here..
'ReEnable the Updating of this Window
Call LockWindowUpdate(0)
End Sub
------------------
Aaron Young
Analyst Programmer
[email protected]
[email protected]
-
Thank you so much, Aaron!
You, too, Bob...except that if a piece is invisible, it is considered to be "off the board". In other words, if I make them invisible, I couldn't see if there was a checkmate or stalemate, because there would be no "valid" pieces to check.
Thanks again for your help, guys.