|
-
Feb 19th, 2002, 03:52 PM
#1
Thread Starter
Frenzied Member
Threading
Code:
#include <windows.h>
void main(){
while(1){
while(FindWindow("IEFrame", NULL));
MessageBox(0, "none", "", 0);
while(!FindWindow("IEFrame", NULL));
MessageBox(0, "one", "", 0);
}
}
I want to know if there are no IE windows open or if there is at
least one open. The code works, but it ties up 100% of my CPU
and also I want to be able to run other code while this code is
running.
I thought of creating a separate thread to run the code above
but will I still have the same problem with all the resources being
tied up?
-
Feb 19th, 2002, 05:24 PM
#2
You should set the thread you create to a low priority, then it doesn't hinder anyone from doing real work.
All the buzzt
 CornedBee
"Writing specifications is like writing a novel. Writing code is like writing poetry."
- Anonymous, published by Raymond Chen
Don't PM me with your problems, I scan most of the forums daily. If you do PM me, I will not answer your question.
-
Feb 19th, 2002, 06:02 PM
#3
Fanatic Member
This may or may not be a valid suggestion, but wouldn't it be possible to create a system wide hook to look out for the WM_CREATE message? Then you could check through all open windows for the IE one, assuming a new window had been created...?
I have no idea how to do this... CornedBee? Any suggestions?
Digital-X-Treme
Contact me on MSN Messenger: [email protected]
[VBCODE]Debug.Print Round(((1097) - ((55 ^ 5 + 311 ^ 3 - 11 ^ 3) _
/ (68 ^ 5))) ^ (1 / 7), 13)[/VBCODE]
-
Feb 20th, 2002, 10:05 AM
#4
indeed, that should be possible. The problem is that a dll means a lot of additional work: writing a dll, searching the messages, installing the hook. And you have an additional file to distribute.
But since you are looking for the IE, isn't it possible to write an IE extension dll? This dll could search for YOUR app at creation and send it a message.
All the buzzt
 CornedBee
"Writing specifications is like writing a novel. Writing code is like writing poetry."
- Anonymous, published by Raymond Chen
Don't PM me with your problems, I scan most of the forums daily. If you do PM me, I will not answer your question.
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
|