|
-
Oct 5th, 2000, 07:07 AM
#1
Thread Starter
New Member
How can you manage to close all Internet Explorer Windows, except one (knowing its handle)?
I tried to use the FindWindow API function to get the handle of each IE5 window (knowing their class: IEFrame), then compare this handle to the one of the IE window I didn't want to close, and then, if this handle was different, post a message to close the window, otherwise, quit.
Unfortunately, this code worked only once.
So, is there a way to get all the handles of all the IE window actually in memory?
-
Oct 5th, 2000, 08:29 AM
#2
Frenzied Member
that sounds about right to me...keep fiddling, it will work...someday! The secret to writing great code is to take OK code and rewrite it...1000 times. Hope you get it working.
-
Oct 8th, 2000, 05:34 PM
#3
Thread Starter
New Member
32-bit Timer
Well, I finally found time to implement my code, so, I just followed your advice, manipulated my code and finally found another routine to reach this goal.
In fact, the FindWindow Api function seems to only retrieve the handle of the Top-level instance of the application you are looking for. So, it worked only once because, after all the IE instances but one had been destroyed the first time, the last remaining instance became the top-level instance (meaning, the window I wanted to keep became the top-level one), and, when other instances were created later, it still remained the top-level instance, so, my program always checked its handle and since it was the same as the one I wanted to keep, broke the loop.
So, I finally found a way to get the list of all the IE instances in memory using the callback API function EnumWindows and it is now working perfectly!
However, I still need your advices.
My program needs sometimes to use a timer with an interval of 20 minutes or more. However, the built-in VB-timer can only work with an interval of at most 65535 ms (16 bits stored value: unsigned integer).
So, does 32 bit timers exist (timers which interval could be stored in an unsigned long)?
What I am actually using is the 16 bit timer with an interval of 1 min and a counter which increments everytime the Timer event is raised. However, I wonder if the base of time is actually right after 20 incrementations, since every minute, the timer stops, launches the procedure, increments the counter, test it, and restarts for another minute.
-
Oct 8th, 2000, 05:47 PM
#4
Reply to Question
Yes, and you can make one yourself.
First, have a timer with 50 as the interval, and then:
Code:
Private twgeg as Date
Private Sub Timer1_Timer()
Dim twex As Date
format(Now, mm) = twex
If twex - twgeg >= 20 Or twex - twgeg <= 0 Then
'Do your things
Doevents
twgeg = twex
End If
End Sub
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
|