Code:
Public Sub Check_For_Win()
   '-----------------------------------------------------------------------------
   '*Someone win game?, check all possibilities line ups of 3 both X & O
   '-----------------------------------------------------------------------------
   Dim Count_Correct     As Long    'Total of correct in line up / sequence
   Dim Wining_Line(3, 3) As Long    'Store coords of matrix
   Dim i                 As Long    'General working var
   Dim j                 As Long    '""
   Dim k                 As Long    '""
   Dim e                 As Long    '""
   Dim XO_Wins(1)        As Boolean 'X & O flgas set true if game won
   '//
   For j = 0 To 1
       If Not XO_Wins(0) And Not XO_Wins(1) Then
          For k = 0 To 2                           'This array allows us to blink the wining line
              For i = 0 To 2                       '
                  Wining_Line(i, k) = 0            'Reset for next check
              Next
          Next
          Count_Correct = 0
   '//
   'Check rows ply1, ply2 or CPU
          For e = 0 To 2
              For i = 0 To 2
                  If Grid_Set(e, i) = (j + 1) Then 'Inc
                     Count_Correct = Count_Correct + 1
                     Wining_Line(e, i) = 1         'Set
                  End If
              Next
              XO_Wins(j) = (Count_Correct = 3)     'Set flag if 3 in a row
              '//
              If Not XO_Wins(0) And Not XO_Wins(1) Then
                 For k = 0 To 2                    'Reset for next check
                     For i = 0 To 2                '
                         Wining_Line(i, k) = 0     '
                     Next
                 Next
                 Count_Correct = 0
              Else
                 Exit For                          'Bail out we have a winner
              End If
          Next
       End If
   '//
       If Not XO_Wins(0) And Not XO_Wins(1) Then
          For k = 0 To 2                           'Reset for next check
              For i = 0 To 2                       '
                  Wining_Line(i, k) = 0            '
              Next
          Next
          Count_Correct = 0
   '//
   'Cols
          For e = 0 To 2
              For i = 0 To 2
                  If Grid_Set(i, e) = (j + 1) Then 'Inc
                     Count_Correct = Count_Correct + 1
                     Wining_Line(i, e) = 1         'Set
                  End If
              Next
              XO_Wins(j) = (Count_Correct = 3)     'Set flag if 3 in a row
              '//
              If Not XO_Wins(0) And Not XO_Wins(1) Then
                 For k = 0 To 2                    'Reset for next check
                     For i = 0 To 2                '
                         Wining_Line(i, k) = 0     '
                     Next
                 Next
                 Count_Correct = 0
              Else
                 Exit For                          'Bail out we have a winner
              End If
          Next
       End If
   '//
   'Test diagonal \
       If Not XO_Wins(0) And Not XO_Wins(1) Then
          For k = 0 To 2                           'Reset for next check
              For i = 0 To 2                       '
                  Wining_Line(i, k) = 0            '
              Next
          Next
          Count_Correct = 0
          '//
          For i = 0 To 2
              If Grid_Set(i, i) = (j + 1) Then
                 Count_Correct = Count_Correct + 1 'Inc
                 Wining_Line(i, i) = 1             'Set
              End If
          Next
          XO_Wins(j) = (Count_Correct = 3)         'Set flag if 3 in a row
       End If
   '//
       If Not XO_Wins(0) And Not XO_Wins(1) Then
          For k = 0 To 2                           'Reset for next check
              For i = 0 To 2                       '
                  Wining_Line(i, k) = 0            '
              Next
          Next
          Count_Correct = 0
          k = 0
   '//
   'Diagonal /
          For i = 2 To 0 Step -1
              If Grid_Set(k, i) = (j + 1) Then
                 Count_Correct = Count_Correct + 1 'Inc
                 Wining_Line(k, i) = 1             'Set
              End If                               '
              k = k + 1                            'Inc offset for / check
          Next
          k = 0
          XO_Wins(j) = (Count_Correct = 3)         'Set flag if 3 in a row
       End If
   Next
   '//
   Dim Player_Won As Byte
   If XO_Wins(0) Or XO_Wins(1) Then                'X or O Win flags set?
      '//                                          '
      Select Case XO_Wins(1)                       'Which one?
             '//                                   '
             Case True                             '
                  If Players_CHR(0) = 2 Then       'Wining player using 0 or X?
                     Player_Won = 0                'Add to stats
                     Total_Losses(1) = Total_Losses(1) + 1
                  Else
                     Player_Won = 1                'Add to stats
                     Total_Losses(0) = Total_Losses(0) + 1
                  End If
             '//
             Case Else
             '//
                  If Players_CHR(0) = 2 Then
                     Player_Won = 1                'Add to stats
                     Total_Losses(0) = Total_Losses(0) + 1
                  Else
                     Player_Won = 0                'Add to stats
                     Total_Losses(1) = Total_Losses(1) + 1
                  End If
      End Select
  '//
  'Inform who won
      Game_Msg.Caption = Players_Name(Player_Won) & " WON!"
      Total_Wins(Player_Won) = Total_Wins(Player_Won) + 1
  '//
      If Settings_Play_Sound.Checked Then
         i = sndPlaySound(App.Path & "\Win.wav", CSNDaSync)
      End If
  '//
  'Player's or CPU's best time?
      If Game_Duration < Best_Time(Player_Won) Or Best_Time(Player_Won) = 0 Then
         Best_Time(Player_Won) = Game_Duration
      End If
  '//
      Game_Rounds = Game_Rounds + 1                'Inc round count
      Call LED_Displays                            'Refresh displays
      Game_Over = True                             'Flag set
  '//
      If Not Terminate_App Then                    'Object still loaded?
         For e = 0 To 10
             For i = 0 To 2
                 For j = 0 To 2
              'Scrn_Render all current
                     BitBlt Play_Area.hDC, 9 + (i * 60), 9 + (j * 60), 45, 45, X0(Grid_Set(j, i)).hDC, 0, 0, SrcCopy
   '//
              'Flash render wining
                     If k And Wining_Line(j, i) Then
                        BitBlt Play_Area.hDC, 9 + (i * 60), 9 + (j * 60), 45, 45, X0(0).hDC, 0, 0, SrcCopy
                     End If
                 Next
             Next
   '//
             Call Delay(250)                       '250mS
             Play_Area.Cls                         'Wipe screen
             k = k + 1                             'Inc K which allows the winning line to be flashed
             k = k Mod 2                           'Reset K
             DoEvents                              'Yeild to OS
   '//
   'Player select new round or request app term?, bail out of here is so...
             If Game_Duration = 0 Or Terminate_App Then Exit For
         Next
      End If
   '//
   'Music playing?
      If Not Terminate_App Then
         If Settings_Play_Music.Checked Then
            Music ("stop med")                     'Cease music!
         End If
      End If
   End If
End Sub