Kill all childen threads on close?

In my jfx2 app I have a thread that gets stood up. When I click the [X] for the main application window I want all "child threads" to be killed. Is this possible? I have not seen anything in the tutorials to describe this nor a way to override a "onClose" like method? Any help would be great.
Riley

Use childThread.setDaemon(true) for all child threads:
(http://www.jguru.com/faq/view.jsp?EID=43724 "What is a daemon thread? When should I use setDaemon() and why?")
If it is not possible to use a Daemon thread, implement logic in an onHidden event handler to notify the threads that they need to shutdown, implement logic in the threads to handle the shutdown notification, and join to each of the threads to await their completion or use a CountDownLatch. If you do this you might want to do the join or CountDownLatch wait in it's own seperate shutdown thread so as not to block the JavaFX application thread.
http://docs.oracle.com/javafx/2.0/api/javafx/stage/Window.html#setOnHidden%28javafx.event.EventHandler%29
http://javahowto.blogspot.com/2007/05/when-to-join-threads.html
http://javahowto.blogspot.com/2011/08/when-to-join-threads-with.html
Or, if there would be no adverse consequences, you can just call System.exit as aidreamer suggests.

Similar Messages

  • System.exit() didn't kill all the threads it spawned in Linux

    Facing problem while doing System.exit(0);
    Even though it is happening inconsistently but this how it is-------.
    The main application has spawned some threads.
    On receiving a particular event it interrupts all the threads and calls system.exit(0).
    Each thread after catching interrupted exception sends a interrupt to itself.
    What I'm observing is, once in a while the spwned threads are still hanging even though the application has exited.
    I'm having
    1) java version "1.4.2_04" and
    2) Linux 2.4.21-27.EL

    After writing Java code for 6 or 7 years, then having a years break and writing C++
    and D code. I came back to Java and am having the same problem as you.
    The cause of my problem was that I was writing the wrong code lol I was
    trying to use an ActionEvent instead of a WindowEvent ie:
    Im on Slackware btw. (nothing but the best )
    PS. I have also noticed that MPlayer does the same thing when you close it down.
    you can see it in the System processes still running. I havent looked at their
    code though.

  • How can I kill all Threads of the same class from within the run() method?

    Ok
    I have a class called Consumer that extends Thread
    I have several Consumer threans running... but, when a certain condition is true (within the run() method) in ANY of the threads, I want to kill ALL the threads of that object.
    is this possible?

    I know this is gonna be too demanding, but can someone please tell me why my Consumer's run() method never reaches the System.out.println( "ALL CONSUMING DONE") line
    Create a multi-threaded prime number calculator that is based on the producer-consumer model
    using semaphores. Your program should be able to check for prime numbers in a range specified
    by the user and with a variable number of threads. Example:
    $ java PrimeFind 3 5000 10000
    should use 1 producer and 2 consumers (3 threads in total, obviously the minimum is 2) to find all
    the prime numbers in the range [5000,10000].
    The producer should: use a buffer to store candidate numbers that have to be checked for
    primality.
    Consumers should: read from the buffer, check if a number is prime and update the status of the
    program accordingly (e.g. show the number on the screen, or save it to a file)
    import java.util.concurrent.Semaphore;
    import java.io.*;
    public class Assign1 {
    static int fromThisNumber;
    static int toThisNumber;
    static int numberOfThreads;
    static int buffer[];
    static Semaphore ready;          /*This semaphore is used by the Producer to signal
                                         an "OK" to the consumers*/
    static Semaphore critical;  /*This is a Mutex semaphore. It allows only 1 consumer
                                         to enter his critical section.
    static Semaphore counter;     /*This semaphore acts as a counter.
                                        Instead of having a global variable
                                         incremented each time, we just release()
                                         this semephore when we find a prime number
                                         Because remember that release() increments permits
    static Producer prod;
    static Consumer cons[];
    static int in=0;
    static int out=0;
    static PrintWriter outFile;
         public static void main (String args[]){
              try{
                   outFile=new PrintWriter(new FileWriter("primes.txt"));
                   }catch(Exception e){}
              numberOfThreads=Integer.parseInt(args[0]);
              fromThisNumber=Integer.parseInt(args[1]);
              toThisNumber=Integer.parseInt(args[2]);
              buffer=new int[Integer.parseInt(args[2])-Integer.parseInt(args[1])+1];
              ready=new Semaphore(0,false); /*We initialise it to 0 because we wait
                                                      for the Producer to produce atleast a
                                                      item. Suppose ready was 1 and if
                                                      Consumer ran first he would be in an
                                                      empty buffer */
              critical=new Semaphore (1,false);/*We initialise it to 1 because when
                                                         the first Consumer thread tries
                                                         to enter its critical section, it
                                                         should be allowed to;
                                                         Subsequent threads will have to
                                                         wait since only 1 thread can
                                                         access its critical section at a time*/
              counter=new Semaphore(0,false); // duh!
              cons=new Consumer[numberOfThreads-1]; /*numberOfThreads-1 because 1 thread
                                                                is taken by the Producer*/
              //Creating Producer object
              prod=new Producer();
              //Creating the Consumer object and start the thread.
              for(int i=0;i<cons.length;i++)
                        cons=new Consumer();
                        cons[i].start();
              prod.start();          
              //Printing to screen and file
    /*          for(int i=0;i<buffer.length;i++)
                   if(buffer[i]!=0)
                             System.out.println(buffer[i]);
                             outFile.println(buffer[i]);
              System.out.println("Total primes found between "+args[1]+" and "+toThisNumber+": "+counter.availablePermits()+"\n primes.txt written");
              outFile.println("Total primes found between "+args[1]+" and "+toThisNumber+": "+counter.availablePermits());
              outFile.close();*/                    
    static class Producer extends Thread {
         public void run(){try{
              while(in<buffer.length)     /*'in' should always be more than 'out'.Oherwise the consumer will try to access an empty index*/
                   {     System.out.println("producing");     
                        buffer[in]=fromThisNumber;
                        in++;
                        fromThisNumber++;
                        ready.release();
              catch (Exception e){e.printStackTrace();}
              System.out.println("ALL PRODUCING DONE");
    static class Consumer extends Thread {
         int tempout=0;
         public void run(){try{
              System.out.println("before while"+this.getId());
              while(tempout<=in)
                   System.out.println("before ready"+this.getId()+" "+ready.availablePermits()+" "+in);
                   ready.acquire();
                   System.out.println("before critical.acquire"+this.getId());
                   critical.acquire();
                   tempout=out;
                   out++;
                   critical.release();               
                   if(!isPrime(buffer[tempout]))
                        {System.out.println(buffer[tempout]+" by "+this.getId());buffer[tempout]=0;}
                   else {counter.release();System.out.println("prime added: "+buffer[tempout]+" by "+this.getId());}
                   critical.acquire();
                   tempout=out;
                   System.out.println("tempout:"+tempout+" of "+this.getId());
                   critical.release();
              System.out.println("ALL CONSUMING DONE"+this.getId());
         catch(Exception e){e.printStackTrace();}
         //Prime number-checking method     
         public boolean isPrime(int n){
              for(int i=2;i<=(n/2);i++)
                   if(n%i==0)
                        return false;
              return true;
    ======================
    import java.util.concurrent.Semaphore;
    import java.io.*;
    /* 3 questions to ask Barlas
    * Why error if I start the Consumer threads before Producer
    * Why does the counter semaphore always give a +1 result at the end
    * Is there a way I can verify that all the work is not being done by only 1 consumer thread? In other words, the workload is being shared properly
    * if I put ready.acquire() outside or inside the while loop, its not making any difference, why?
    * Strangely, its not making any difference if I playing with the release() and aquire() of the semaphores, WHY?!?!
    public class Assign1 {
    static int fromThisNumber;
    static int toThisNumber;
    static int numberOfThreads;
    static int buffer[];
    static Semaphore ready;          /*This semaphore is used by the Producer to signal
                                       an "OK" to the consumers*/
    static Semaphore critical; /*This is a Mutex semaphore. It allows only 1 consumer
                                       to enter his critical section.
    static Semaphore counter;     /*This semaphore acts as a counter.
                                  Instead of having a global variable
                                       incremented each time, we just release()
                                       this semephore when we find a prime number
                                       Because remember that release() increments permits
    static Producer prod;
    static Consumer cons[];
    static int in=0;
    static int out=0;
    static PrintWriter outFile;
         public static void main (String args[]){
              try{
                   outFile=new PrintWriter(new FileWriter("primes.txt"));
                   }catch(Exception e){}
              numberOfThreads=Integer.parseInt(args[0]);
              fromThisNumber=Integer.parseInt(args[1]);
              toThisNumber=Integer.parseInt(args[2]);
              buffer=new int[Integer.parseInt(args[2])-Integer.parseInt(args[1])+1];
              ready=new Semaphore(0,false); /*We initialise it to 0 because we wait
                                                      for the Producer to produce atleast a
                                                      item. Suppose ready was 1 and if
                                                      Consumer ran first he would be in an
                                                      empty buffer */
              critical=new Semaphore (1,false);/*We initialise it to 1 because when
                                                      the first Consumer thread tries
                                                      to enter its critical section, it
                                                      should be allowed to;
                                                      Subsequent threads will have to
                                                      wait since only 1 thread can
                                                      access its critical section at a time*/
              counter=new Semaphore(0,false); // duh!
              cons=new Consumer[numberOfThreads-1]; /*numberOfThreads-1 because 1 thread
                                                                is taken by the Producer*/
              //Creating Producer object
              prod=new Producer();
              //Creating the Consumer object and start the thread.
              for(int i=0;i<cons.length;i++)
                        cons[i]=new Consumer();
                        cons[i].start();
              prod.start();          
              //Printing to screen and file
    /*          for(int i=0;i<buffer.length;i++)
                   if(buffer[i]!=0)
                             System.out.println(buffer[i]);
                             outFile.println(buffer[i]);
              System.out.println("Total primes found between "+args[1]+" and "+toThisNumber+": "+counter.availablePermits()+"\n primes.txt written");
              outFile.println("Total primes found between "+args[1]+" and "+toThisNumber+": "+counter.availablePermits());
              outFile.close();*/                    
    static class Producer extends Thread {
         public void run(){try{
              while(in<buffer.length)     /*'in' should always be more than 'out'.Oherwise the consumer will try to access an empty index*/
                   {     System.out.println("producing");     
                        buffer[in]=fromThisNumber;
                        in++;
                        fromThisNumber++;
                        ready.release();
              catch (Exception e){e.printStackTrace();}
              System.out.println("ALL PRODUCING DONE");
    static class Consumer extends Thread {
         int tempout=0;
         public void run(){try{
              System.out.println("before while"+this.getId());
              while(tempout<=in)
                   System.out.println("before ready"+this.getId()+" "+ready.availablePermits()+" "+in);
                   ready.acquire();
                   System.out.println("before critical.acquire"+this.getId());
                   critical.acquire();
                   tempout=out;
                   out++;
                   critical.release();               
                   if(!isPrime(buffer[tempout]))
                        {System.out.println(buffer[tempout]+" by "+this.getId());buffer[tempout]=0;}
                   else {counter.release();System.out.println("prime added: "+buffer[tempout]+" by "+this.getId());}
                   critical.acquire();
                   tempout=out;
                   System.out.println("tempout:"+tempout+" of "+this.getId());
                   critical.release();
              System.out.println("ALL CONSUMING DONE"+this.getId());
         catch(Exception e){e.printStackTrace();}
         //Prime number-checking method     
         public boolean isPrime(int n){
              for(int i=2;i<=(n/2);i++)
                   if(n%i==0)
                        return false;
              return true;
    ===========================
    BTW, when I tried to change extends Thread to implements Runnable I got some kinda of error.
    Actually, my program is pretty complete... its just that something if messed up in my Consumer's run() method's while loop... I think
    I know guys its crazy to ask ya'll to look at so much code, but.... I'd really appreciate it. This assignment is killing me, been at it since 10 hours now....

  • Sharing a physical machine / without killing all my apps

    I've created a user account for a friend who occasionally uses my laptop to surf the web. OS X is telling me that for a second user to login, I need to logout, kill all my open apps, close all files, etc.
    Seems to me I ought to be able to suspend my login session - then allow my friend to login and surf the web - and then resume my session with apps and files open as I last worked on them. How/can I access "suspend login session" and "resume login session" functionality?
    Thanks.
    -ashish

    System Preferences/Accounts
    Check "Show fast user switching menu as:" and select how you want to display user names.
    When you want to switch users, click on the user name in the upper right corner (next to the Spotlight icon).

  • How to close instance of Firefox launched via File/New Window without killing all Firefox instances?

    Prior to the latest Firefox update, running on Ubuntu if it makes a difference, I was able to select Close from the File menu (and if memory serves also by clicking the x on the last tab) to exit an instance of Firefox opened via File New Window.
    With the 9.x update this no longer seems to be possible. If I choose file quite from an instance that was launched via New Window all Firefox instances go away!
    This is annoying as I have to leave any instances that were launched.
    I tried the Close Last Tab add on, and it lets me close the content of the last tab but still leaves the instance running with a blank tab.
    Is there a configuration setting somewhere that I have missed to restore the previous mode of operation for exiting additional instances of Firefox without killing all of them?
    Thanks,
    Burt

    Each window should have its own Close button (big X in the right hand corner.)
    But this is dependent on the "Theme" you are using in Ubuntu. This big X chould be a Round Dot when you hover over the color changes. It could be on the Left site instead of the right.
    This [http://cdn.omgubuntu.co.uk/wp-content/uploads/2012/01/screen-shot-2012-01-11-at-15.52.36.jpg Screenshot] Shows the Close button the Left Side, still an X though.
    CTRL+SHIFT+W will close the Active window.
    CTRL+W will close the Active Tab.

  • I DON'T WANT TO UPGRADE OR HAVE AN ADD ON EVER, DISABLING UPDATES DOES NOT WORK, HOW DO I KILL ALL MEASAGES FOR UP GRADES AND ADD ON'S FOR EVER, ONCE AND FOR ALL, COMPLETELY, THE END AND NEVER BE BOTHERED AGAIN EVER!

    I DON'T WANT TO UPGRADE OR HAVE AN ADD ON EVER, DISABLING UPDATES DOES NOT WORK, HOW DO I KILL ALL MESSAGES FOR UP GRADES AND ADD ON'S FOR EVER, ONCE AND FOR ALL, COMPLETELY, THE END AND NEVER BE BOTHERED AGAIN EVER! ALSO IF I KILL MYSELF I WILL HOLD YOU PERSONALTY RESPONSIBLE.edit

    There is a world of information in these forums if you use the search function near the top right of this page. Just type in NAS for example and you get many threads on the subject (marked with a green checkmark if it solved the question) another example would be Airport Exterme and sound system. Once you formulate your ideas better then specific questions can be addressed one at a time. You may find that a less expensive choice for a server might be a mac mini. Good luck with your project, ask more specific questions and update you systems profile.

  • Can't kill a running thread...

    I'm having some problems killing a thread. Becuase thread.stop() is no longer used, I basically set a flag to tell all the threads to return by checking this flag in the run() method. The problem now is that there is a thread that is getting "stuck" in a class that I have no access to. So basically I assume that its a really long loop, or an infinite loop... either way, that thread doesn't stop even if the "parent" (spawning) thread is "stopped". Any suggestions?
    -L

    Java's Thread Tutorial
    JavaWorld: Introduction to Java threads
    IBM: Introduction to Java threads
    Google: java+threads+tutorial
    Why Are Thread.stop, Thread.suspend, Thread.resume and Runtime.runFinalizersOnExit Deprecated?

  • How to kill all swing.Timer(s) at end of App

    I am using a javax.swing.Timer to cause text to flash in the text field. However, I noticed that if this timer is running when I stop my app, the timer's thread is still running. It appears that the class that has the timer is not being garbage collected immediately upon application exit. Is there a way to kill all swing timers?
    Thanks,
    John

    No. This is a class whose implementation I was hoping the main application would not have to know about. I was hoping that since I was using swing timers that when the application on which thread the swing timers are executing exited, all the swing timers attached to that application would be stopped.
    Do you have a suggestion how I might be able to do this? I have an application "A" that uses a library class "B" method that happens to start a timer. I do not want "A" to have to explicitly stop "B" when the application is ending. Is there a way I can tag the timer so that it will stop when "A" exits? Or could I somehow link "B" to "A" so that a dispose method on "B" is called when "A" exits or disposes?
    Thanks,
    John

  • How to Kill Specific Execute Threads

    Hi.
    Through our application server, we noticed that there were some memory issues
    where the memory usage would rapidly increase from ~ 15Mb to the max heap size.
    Issuing a few thread dumps, we realized that there was a specific thread that
    was churning. This was b/c someone sent a large request in that generated a lot
    of data.
    Anyways, since we couldn't bounce the weblogic server, we had to wait until the
    request ended. Since we know the specific thread that was assigned to that job,
    is there a way to kill the request associated with a specific execute thread and
    reallocate back to the thread pool? We're running weblogic 6.1sp4. I think the
    executequeueruntime bean just gives me back the current configuration of the all
    the threads in the specific queue, which doesn't help me here.
    Thanks.
    --Selena

    Selena,
    how about get the ExecuteQueueRuntimeMBean and get all the execute
    threads (getExecuteThreads() which returns an array of ExecuteThreads )
    and since you know the thread id that is causing the bottleneck, you
    could kill that thread.
    thanks,
    -satya
    Selena wrote:
    Hi.
    Through our application server, we noticed that there were some memory issues
    where the memory usage would rapidly increase from ~ 15Mb to the max heap size.
    Issuing a few thread dumps, we realized that there was a specific thread that
    was churning. This was b/c someone sent a large request in that generated a lot
    of data.
    Anyways, since we couldn't bounce the weblogic server, we had to wait until the
    request ended. Since we know the specific thread that was assigned to that job,
    is there a way to kill the request associated with a specific execute thread and
    reallocate back to the thread pool? We're running weblogic 6.1sp4. I think the
    executequeueruntime bean just gives me back the current configuration of the all
    the threads in the specific queue, which doesn't help me here.
    Thanks.
    --Selena

  • Wake up, wait, and kill one / many threads

    Hello all.
    I am trying to do something that I originally wanted to do with multicasting, but in the end could not.
    Essentially I want to create a bunch of threads, one for each machine I want to 'ping' (not the actual ping, just some kind of 'are you alive?'). These threads will just sit there and wait upon creation.
    Then when a request comes in I want to:
    1. wake them all up so they all send a 'ping' to their respective server.
    2. retrieve the ip address (or name) of the first thread that replies
    3. kill the rest of the threads (if they haven't already died)
    4. go back to waiting
    I've been surfing Google, Java tutorial and these forums and can't seem to put it all together.
    Many thanks for any help!
    Bob

    Hello again, thanks for all of the responses.
    I feel like a bit of a schmuck, I had no idea J2SE 5.0 had all of this new concurrency stuff. All of these things -- Semaphores, CountDownLatch, etc. -- are new to me. I've been trapped in the web / MVC world too long. I've used threads in the past but only for simple stuff, always trying to avoid all the messy stuff like synchronized blocks, wait(), notify(), etc.
    So I am boning up on all this new stuff now, thanks.
    As for you comment, 'I don't see the point in terminating them if you are going to repeat the exercise.', you're right, I didn't mean kill the threads that didn't reply first, I meant ignore them.
    Basically I have a situation where I'll have something like 60 requests per minute on average. For each request I want to wake up all the threads, send out a ping and send the request to the ip address of the first thread that replies.
    The problem of course is that during that one request I may have another, and another, since a ping could take anywhere from less than a second to 5 seconds to timeout. So, for example, If another request comes in while 3 out of the total of 5 threads are still pinging, only 2 will be woken up to send out another ping, and so on.
    It's complicated and it would be a lot easier with a simple multicast message using JGroups or a simple Java multicasting. But alas since these servers that I'll be pinging aren't ours, I can neither install a small multicast listener program on them or even be sure multicasting (port 124.0.0.1) is enabled.
    So that's the deal. I'm going to keep reading. Thanks for all of your help!
    Bob

  • Getting all the threads running in one JVM from another JVM ...

    I want to get all the threads running in one JVM from another JVM.
    Is it possible ?
    namanc

    I am going to write a java application that prints all the java application running at the background. And this application has a control over all the threads. means killing the threads, restart the thread etc
    namanc

  • Kill all oracle session

    Situation:
    Oracle Forms 9i application, with multiple oracle forms (MDI). When I call a new forms I use OPEN_FORM(v_cm_module, ACTIVATE, session, pl_id) so I create a new oracle session.
    Problem:
    The user open a lot of windows (oracle forms .fmx with diferent sessions each one) in the oracle forms application, when they close the browser window (X botom of the browser, mozilla, internet explorer), the session are still alive (only kill one session....the first I think).
    I know that after 15 minutes oracle kill the rest of the sessions, but if the user was editing a block (locking a record), and close the browser, the table still lock 15 minutes!!!!.
    Any sugestions:???
    Thanks

    Is it necessary to create a session for each form?
    If so you could do the following:
    in the formsweb.cfg set the seperateframe property on true; and place some JavaScript code into the htmlafterform property:
    HTMLafterForm=<script type="text/javascript"> window.moveTo(-10000, -10000); </script>
    now you have a seperate frame, the browser window gets moved to a position where you can't see it ;-). when clicking the X button in the seperate frame the current form will be closed; your MDI application is still running...if you wan't you can write a JavaBean, and get the windowlisteners of the seperate frame and replace them with your own...of course you can close the Browser by right clicking and closing it in the taskbar; but that's a thing you must live with...
    besides that I have no clue how to get rid of those sessions, as I don't you have any event you can act with when closing the Browser. But if so you could save every sid in every when-new-form-instance trigger (you can get it from v$mystat), and when this event occurs you could kill all those sessions (alter system kill session ....) ;-). but as far as I know that's not possible...
    regards
    christian

  • How can a thread kill another blocked thread?

    Hello All,
    As the title mentioned, lets say i have a main class in which i created a new thread but for some reason, this thread is blocked so i want to find a way to kill this thread from the main class (the interrupt function is not working), is there a workarround to do this?
    Thank you in advance

    Hello,
    First of all, thanks for you interventions, i think i should clearify my case:
    I have a website which has a "Search the site" feature where a user can search the site for specific keywords
    The search engine is an external jar which we use by calling its API, but for some reason this search engine becomes blocked sometimes so my jsp which is calling this API gets also blocked and any subsequent search gets also blocked in the end the number of java threads becomes very high in my system!
    i want to find a way so that if the piece of code calling the search API didnt get excuted during a specific period, i want to kill the thread calling the search API
    lets say the search form is submitted to the following jsp
    // Here we have a SearchThread extends Thread
    /* i launched a new Thread to do the search independatly from the main process*/
    SearchThread task = new SearchThread("search_input");
    task.start();
    /* In the searchThread class we have a run method containing the following line which calls the search API, for some reason , this line never returns and keeps the thread in Running state and so the run() method never returns and so the thread will neve be dead :( */
    SearchLoginSession = new SearchLoginSession (configFile, true);
    Notes:
    1) the stop is deprecated i cant use it
    2) the suspend method will suspend it and not kill it, the thread will remain in memory
    3) the interrupt method didnt work
    4)i am working in a multi-cpu environment
    Finally , what i want is to find a way to remove this thread from memory from the main jsp listed above like
    task.kill() or some workarround
    Thank you for reading and hope you can help me

  • 10.6.4 WindowServer crashes, kills all applications

    After upgrading from 10.6.3 to 10.6.4, selecting "Login Window..." in Fast User Switching causes WindowServer to crash (SIGSEGV), killing ALL running applications.
    Process: WindowServer [21110]
    Path: /System/Library/Frameworks/ApplicationServices.framework/Versions/A/Frameworks/ CoreGraphics.framework/Versions/A/Resources/WindowServer
    Identifier: WindowServer
    Version: ??? (???)
    Code Type: X86-64 (Native)
    Parent Process: launchd [1]
    Date/Time: 2010-06-23 09:43:30.918 +0200
    OS Version: Mac OS X 10.6.4 (10F569)
    Report Version: 6
    Exception Type: EXCBADACCESS (SIGSEGV)
    Exception Codes: KERNINVALIDADDRESS at 0x00000002b42b2200
    Crashed Thread: 0 Dispatch queue: com.apple.main-thread
    I wanted to submit the full crash report to Apple, but could not find out how to do it. Looks like Apple does not like to receive bug reports
    Any suggestion?
    Thanks,
    Olivier

    This is how to report this issue to Apple's engineering. Send a bug report or an enhancement request via its Bug Reporter system. Join the Mac Developer Program—it's free and available for all Mac users and gets you a look at some development software. Since you already have an Apple username/ID, use that. Once a member, go to Apple BugReporter and file your bug report or enhancement request.

  • VB script to kill all PC Suite processes

    Hello :-)
    You know how some PC Suite components hang when the connection with the phone is interrupted? And how you have to log off and back on to clear it?
    I got fed up of doing that so knocked up this VB script and called it "PC Suite kill.vbs". Snappy name, eh? Maybe I should take up copywriting.
    It's developed and tested (= hacked together) with PC Suite 6.7.0.22 on Windows XP Pro SP2. Please back up all your data and lock your daughters away before trying it at home. Guaranteed no registry hacks.
    If you try "PC Suite kill.vbs" on another version of PC Suite and Windows and it doesnt kill PC Suite and all its components it's probably because the "path names" of the programs are different. To solve this problem there's another VB script below, snappily named "Get info on all processes.vbs", that should give the pathnames on your computer. You have to start PC Suite and whichever component(s) are not being killed then run "Get info on all processes.vbs, look in C:\temp.txt for the pathnames and copy-and-paste them into your copy of "PC Suite kill.vbs".
    Feedback appreciated -- would be nice to make "PC Suite kill.vbs" detect the PC Suite version and Windows version and adapt itelf accordingly.
    Here come the scripts. No file attachment facility on this board so they're in the message. Beware split lines.
    === "PC Suite kill.vbs" starts ===
    ' Nokia PC Suite kill
    ' Usage:
    ' * No options or arguments
    ' * Developed and tested with PC Suite 6.7.0.22 and Windows XP Pro SP2
    ' 30may06 Charles Atkinson
    ' * Quick and dirty to kill all PC Suite processes.
    ' Written because parts of PC Suite hang if the connection with the phone is interrupted
    ' Acknowledments to Hans-Georg Michna (www.michna.com/nokia6230.htm) for the idea and .BAT example
    ' Wishlist
    ' * Detect PC Suite and Windows versions and modify behaviour to suit
    ' * Cope with %systemroot% being other than C:
    Option Explicit
    ' Declare constants
    Const strComputer = "."
    ' Declare variables
    Dim intCounter
    Dim intProcessNamesIdxMax
    Dim objProcess
    Dim objShell
    Dim strProcessNames(14)
    ' Initialise variables
    strProcessNames(1) = "C:\PROGRA~1\COMMON~1\PCSuite\Services\SERVIC~1.EXE"
    strProcessNames(2) = "C:\PROGRA~1\COMMON~1\Nokia\MPAPI\MPAPI3s.exe"
    strProcessNames(3) = "C:\PROGRA~1\COMMON~1\PCSuite\DATALA~1\DATALA~1.EXE"
    strProcessNames(4) = "C:\PROGRA~1\COMMON~1\PCSuite\Services\SERVIC~1.EXE"
    strProcessNames(5) = "C:\Program Files\Nokia\Nokia PC Suite 6\ApplicationInstaller.exe"
    strProcessNames(6) = "C:\Program Files\Nokia\Nokia PC Suite 6\AudioManager.exe"
    strProcessNames(7) = "C:\Program Files\Nokia\Nokia PC Suite 6\ConnectionManager.exe"
    strProcessNames(8) = "C:\Program Files\Nokia\Nokia PC Suite 6\ContentCopier.exe"
    strProcessNames(9) = "C:\Program Files\Nokia\Nokia PC Suite 6\ImageConverter.exe"
    strProcessNames(10) = "C:\Program Files\Nokia\Nokia PC Suite 6\ImageStore.exe"
    strProcessNames(11) = "C:\Program Files\Nokia\Nokia PC Suite 6\LaunchApplication.exe"
    strProcessNames(12) = "C:\Program Files\Nokia\Nokia PC Suite 6\MultimediaPlayer.exe"
    strProcessNames(13) = "C:\Program Files\Nokia\Nokia PC Suite 6\OneTouchAccess.exe"
    strProcessNames(14) = "C:\Program Files\Nokia\Nokia PC Suite 6\PcSync2.exe"
    intProcessNamesIdxMax = 14
    ' For each process
    For each objProcess in GetObject( "winmgmts:" ).InstancesOf( "Win32_Process" )
    ' Compare with each known PC Suite process
    For intCounter = 1 To intProcessNamesIdxMax Step 1
    ' And if it matches
    If strProcessNames( intCounter ) = objProcess.ExecutablePath Then
    objProcess.Terminate
    Exit For
    End If
    Next
    Next
    Wscript.Quit 0
    === "PC Suite kill.vbs" ends ===
    === "Get info on all processes.vbs" starts ===
    ' Get info on all processes
    ' Usage:
    ' * No options or arguments
    ' * Output to C:\temp.txt
    ' * Developed and tested with Windows XP Pro SP2
    ' 30may06 Charles Atkinson
    ' * Quick and dirty to get info on all processes.
    ' Written to get full path names for PC Suite processes for "PC Suite kill and restart.vbs"
    ' Declare constants
    Const intForWriting = 2
    ' Open text file for writing
    Set objFSO = CreateObject( "Scripting.FileSystemObject" )
    Set objTextFile = objFSO.OpenTextFile( "C:\temp.txt", intForWriting, True )
    ' For each process ...
    for each objProcess in GetObject( "winmgmts:" ).InstancesOf( "Win32_Process" )
    strCreationDate = Mid(objProcess.CreationDate,7,2) & "/" & Mid(objProcess.CreationDate,5,2) & "/" & Left(objProcess.CreationDate,4) & " " & Mid(objProcess.CreationDate,9,2) & ":" & Mid(objProcess.CreationDate,11,2) & ":" & Mid(objProcess.CreationDate,13,2)
    objTextFile.WriteLine( objProcess.ProcessId & "," & objProcess.ParentProcessId & "," & strCreationDate & "," & objProcess.Name & "," & objProcess.ExecutablePath )
    next
    ' Close file and exit
    objTextFile.Close
    Wscript.Quit 0
    === "Get info on all processes.vbs" ends ===
    Nokia 5130c-2

    You can download the scripts from here.
    They have extension .txt to comply with Yahoo's restrictions. You'll need to change it to .vbsMessage Edited by catkin on 06-Jun-2006
    12:47 PM
    Nokia 5130c-2

Maybe you are looking for