Results 1 to 4 of 4

Thread: Threading

  1. #1

    Thread Starter
    Frenzied Member
    Join Date
    Aug 2000
    Location
    Birmingham, AL
    Posts
    1,276

    Question 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?

  2. #2
    Kitten CornedBee's Avatar
    Join Date
    Aug 2001
    Location
    In a microchip!
    Posts
    11,594
    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.

  3. #3
    Fanatic Member
    Join Date
    Sep 2000
    Location
    UK.
    Posts
    728
    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]

  4. #4
    Kitten CornedBee's Avatar
    Join Date
    Aug 2001
    Location
    In a microchip!
    Posts
    11,594
    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
  •  



Click Here to Expand Forum to Full Width