Code:
Public Sub KillBlacklisted()
On Error GoTo Err_Handler
Dim cn As New ADODB.Connection
Dim rs As New ADODB.Recordset
Dim con As New DLLConnectionFunction
Set con = New DLLConnectionFunction
Dim strsql As String
DoEvents
If IsNetConnectionAlive = True Then
If con.ConnectDBMsSQLOLEDB2005(cn, "172.29.2.100", "db", "sa", "pwd") = True Then
strsql = "select * from netblacklist order by blacklist asc"
If con.ConnectRS(cn, rs, strsql, rsadOpenStatic, rsadLockPessimistic) = True Then
DoEvents
Do Until rs.EOF And loopme = True
'If loopme = False Then
' Exit Do
' Exit Do
' Exit Do
'ElseIf loopme = True Then
findme1 rs.Fields("blacklist")
'End If
rs.MoveNext
Loop
Timer1.Interval = 500
Timer1.Enabled = False
'Else
' con.DisconnectRS rs
' Timer1.Interval = 500
' Timer1.Enabled = false
End If
'Else
' con.DisconnectRS rs
' Timer1.Interval = 500
' Timer1.Enabled = false
End If
Else
con.DisconnectRS rs
Timer1.Interval = 500
Timer1.Enabled = False
End If
con.DisconnectCN cn
Set con = Nothing
Exit_Sub:
Exit Sub
Err_Handler:
DoEvents
Timer1.Interval = 500
Timer1.Enabled = False
Resume Exit_Sub
End Sub
what the program does is it detects the windows titlebar description and if it contains any of the word, it will shutdown that
application.
My problem is, yes it does detect and shutdown the detected application but the program hangs and it seems it finishes up to the end of the blacklist recordset.
Kindly check my loop or any error why it hangs.