Results 1 to 4 of 4

Thread: An easy one, Im sure...

  1. #1

    Thread Starter
    Frenzied Member
    Join Date
    Jan 2000
    Location
    Bellevue, WA, USA
    Posts
    1,357

    Post

    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

  2. #2
    Hyperactive Member
    Join Date
    Sep 1999
    Posts
    305

    Post

    Could you maybe set the properties of the pieces to invisible?

  3. #3
    Guru Aaron Young's Avatar
    Join Date
    Jun 1999
    Location
    Red Wing, MN, USA
    Posts
    2,176

    Post

    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
    aarony@redwingsoftware.com
    ajyoung@pressenter.com


  4. #4

    Thread Starter
    Frenzied Member
    Join Date
    Jan 2000
    Location
    Bellevue, WA, USA
    Posts
    1,357

    Post

    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.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width