Can you tell me why this coding does not work? I had to make some variables into variants to get the program to run(without runtime errors) which I shouldn't have had to do. Now the program does not block pop-ups, arrrgggghhh!
Private Sub t_Detect_Timer()
Dim ieframe As Long, workerw As Long, rebarwindow As Long
Dim comboboxex As Long, combobox As Long, editx As Long
Dim allowed As Integer, nallowed As Integer, allowednum As Variant
Dim trusted As String, trustnum As Variant, NoTrust As Integer
'Lets find stuff.
ieframe = FindWindow("ieframe", vbNullString)
workerw = FindWindowEx(ieframe, 0&, "workerw", vbNullString)
rebarwindow = FindWindowEx(workerw, 0&, "rebarwindow32", vbNullString)
comboboxex = FindWindowEx(rebarwindow, 0&, "comboboxex32", vbNullString)
combobox = FindWindowEx(comboboxex, 0&, "combobox", vbNullString)
editx = FindWindowEx(combobox, 0&, "edit", vbNullString)
If ieframe <> 0 & editx <> 0 Then
'Lets retrieve the URL.
Dim TheURL As String, TU As Long
TU = SendMessageLong(editx, WM_GETTEXTLENGTH, 0&, 0&
TheURL = String(TU + 1, " ")
Call SendMessageByString(editx, WM_GETTEXT, TU + 1, TheURL)
TheURL = Left(TheURL, TU)
'Did we get anything?
For trustnum = 0 To CInt(f_Opts.n_Trusted.ListCount)
trusted = f_Opts.n_Trusted.List(trustnum)
'Is it trusted?
If Len(TheURL) > 0 Then
If Left(TheURL, Len(trusted)) = trusted Then
f_Main.n_A2Run.AddItem (ieframe)
ElseIf Len(TheURL) > 2 Then
TheURL = Right(TheURL, Len(TheURL) - 2)
If Left(TheURL, Len(trusted)) = trusted Then
f_Main.n_A2Run.AddItem (ieframe)
Else
NoTrust = NoTrust + 1
End If
End If
End If
trusted = ""
TheURL = ""
Next trustnum
For allowed = 0 To n_A2Run.ListCount
allowednum = n_A2Run.List(allowed)
If ieframe = allowednum Then
NoTrust = NoTrust - 1
End If
allowednum = 0
Next allowed
Label1.Caption = NoTrust
If NoTrust >= f_Main.n_A2Run.ListCount Then
If (GetKeyState(VK_CONTROL) And &H8000) <> 0 Then
f_Main.n_A2Run.AddItem (ieframe)
ElseIf (GetKeyState(vbKeyControl) And &H8000) <> 0 Then
f_Main.n_A2Run.AddItem (ieframe)
Else
Call PostMessage(ieframe, WM_CLOSE, 0&, 0&
Call SaveSetting("CBlock", "Options", "Blocked", GetSetting("CBlock", "Options", "Blocked", 0) + 1)
n_Bcount.Caption = n_Bcount.Caption + 1
n_BCountShad.Caption = n_Bcount.Caption
NoRecurse = True
If f_Opts.n_Sound.Value Then
Call Playwav(App.Path & "\Blocked.wav")
End If
NoRecurse = False
End If
End If
NoTrust = 0
ElseIf ieframe <> 0 Then
'We didn't find the window for the URL.
For allowed = 0 To n_A2Run.ListCount
allowednum = n_A2Run.List(allowed)
If Not (ieframe) = allowednum Then
nallowed = nallowed + 1
End If
allowednum = 0
Next
'If its not allowed and no Control button, hurt it.
If nallowed >= n_A2Run.ListCount Then
If (GetKeyState(VK_CONTROL) And &H8000) <> 0 Then
n_A2Run.AddItem ieframe
ElseIf (GetKeyState(vbKeyControl) And &H8000) <> 0 Then
n_A2Run.AddItem ieframe
Else
Call PostMessage(ieframe, WM_CLOSE, 0&, 0&
Call SaveSetting("CBlock", "Options", "Blocked", GetSetting("CBlock", "Options", "Blocked", 0) + 1)
n_Bcount.Caption = n_Bcount.Caption + 1
n_BCountShad.Caption = n_Bcount.Caption
NoRecurse = True
If f_Opts.n_Sound.Value Then
Call Playwav(App.Path & "\Blocked.wav")
End If
NoRecurse = False
End If
End If
End If
nallowed = 0
ieframe = 0
End Sub
-kwandobe