|
-
Sep 2nd, 2006, 09:54 PM
#1
Thread Starter
Hyperactive Member
[RESOLVED] Timer Problem
Hey, I've just finished creating a program which searches for an instance of IE, and if it's found, to close IE, and open that same URL in firefox (Because I use windowsKey-e to open the browser usually =D )
All's working great, but i've just now added a timer so that the loop which watches for IE doesn't hog all the CPU.
Basically, the timer checks every two seconds for either an IE window or a directory browser window (My Computer, etc). If found, it then opens up the loop which waits for the directory browers window to visit a website, and then closes IE when that happens.
If while in the loop the windows are no longer found, the loop exits and (should) go back to the timer, but it doesnt
The code im using is:
VB Code:
Private Sub loopingIt()
Dim foundUrl As String, counter As Integer
counter = 0
While IEHndl <> 0
counter = counter + 1
If counter > 1000 Then
foundUrl = ""
foundUrl = findIEUrl
DoEvents
Debug.Print "LOOPING"
If Trim(foundUrl) <> "" And Left(Trim(foundUrl), 4) = "http" Then
PostMessage IEHndl, WM_CLOSE, 0, 0&
DoEvents
Shell "C:\Program Files\Mozilla Firefox\firefox.exe " + foundUrl, vbNormalFocus
End If
counter = 0
End If
Wend
tmrCheckWindow.Interval = 2000
tmrCheckWindow.Enabled = True '<<<<<<<<<<<<<<<<<<<<< Here
End Sub
Private Sub Form_Load()
App.TaskVisible = False
End Sub
Private Sub tmrCheckWindow_Timer()
findIEUrl
Debug.Print "JuST CHECKING"
If IEHndl <> 0 Then
loopingIt
tmrCheckWindow.Enabled = False
End If
End Sub
The timer never starts up again. I've breakpointed the .enabled = true line, and it's triggering, but the timer never restarts
Any ideas?
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|