C# threads menu

User Tag List

Thread: C# threads

Results 1 to 7 of 7
  1. #1
    luciferc's Avatar Contributor
    Reputation
    90
    Join Date
    Jul 2008
    Posts
    373
    Thanks G/R
    0/0
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    C# threads

    So for when my bot shutsdown or someone closes it i made a restarter/relogger app.

    It logs you in etc.

    But the problem is if the Form1 Window is closed i have a bunch of remote threads running that will keep running since it doesn't know that its main window is closed.

    So my question is how do i find out if the Form1 Window is closed and to disregard the threads.

    I tryed asking Mr.Google but he didn't anwser me.

    Ty- For anyone who has an awnser

    Was thinking about Vista's ApplicationRecovery Class
    but i am on XP anyways.

    Also Tryed the
    Code:
     private void Form1_Closing(object sender, System.ComponentModel.CancelEventArgs e)
            {
    //Put a Kill Proccess Inside of here and still the Threads ran :O
             }
    Last edited by luciferc; 12-21-2008 at 07:18 PM.

    C# threads
  2. #2
    Apoc's Avatar Angry Penguin
    Reputation
    1388
    Join Date
    Jan 2008
    Posts
    2,750
    Thanks G/R
    0/13
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Thread t = new Thread(yourRunMethod);
    t.IsBackgroundThread = true;
    t.Start();

    IsBackgroundThread will tell it that it's 'not important' when the application is closed. And will shut down the thread then. Without it, the CLR thinks it is a critical thread, and keeps it open until it would normally close down.

  3. #3
    Nesox's Avatar ★ Elder ★
    Reputation
    1280
    Join Date
    Mar 2007
    Posts
    1,238
    Thanks G/R
    0/3
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Thread t = new Thread(new ThreadStart(your function));
    t.Start();

  4. #4
    Apoc's Avatar Angry Penguin
    Reputation
    1388
    Join Date
    Jan 2008
    Posts
    2,750
    Thanks G/R
    0/13
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Originally Posted by Nesox View Post
    Thread t = new Thread(new ThreadStart(your function));
    t.Start();
    Yes, and that thread would run continuously after the application is exited. (And FYI, the new ThreadStart delegate is implied, and can be omitted )

  5. #5
    luciferc's Avatar Contributor
    Reputation
    90
    Join Date
    Jul 2008
    Posts
    373
    Thanks G/R
    0/0
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    What i did was this.

    After testing i found if i close the form the mainwindow title shows up blank so i did a simple.

    Code:
    //Inside of a IF w/ several checks of/c
    p[0].MainWindowTitle.ToString() == ""
    
    Then i do a .Kill();
    
    Gonna change the startings soon :)
    Last edited by luciferc; 12-21-2008 at 07:44 PM.

  6. #6
    luciferc's Avatar Contributor
    Reputation
    90
    Join Date
    Jul 2008
    Posts
    373
    Thanks G/R
    0/0
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    I hope you meant
    Code:
    movethread.IsBackground = true;
    Apoc, b/c i can't find your modifier anywhere :P heh

    And thanks for anwsering.
    Last edited by luciferc; 12-21-2008 at 07:45 PM.

  7. #7
    Apoc's Avatar Angry Penguin
    Reputation
    1388
    Join Date
    Jan 2008
    Posts
    2,750
    Thanks G/R
    0/13
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Originally Posted by luciferc View Post
    I hope you meant
    Code:
    movethread.IsBackground = true;
    Apoc, b/c i can't find your modifier anywhere :P heh

    And thanks for anwsering.
    Lol yea, sorry. That's the one. I use a threading class to handle all my specific threading stuff. So I don't go into the actual Thread class too often. :P

Similar Threads

  1. Joana Mancow Leveling Video Request Thread
    By Matt in forum World of Warcraft General
    Replies: 31
    Last Post: 11-19-2006, 02:54 PM
  2. Decide which Banner we use voting thread
    By Matt in forum Community Chat
    Replies: 43
    Last Post: 06-30-2006, 06:22 AM
  3. MMOwned's Official Unofficial PTR (Public Test Realm) Thread!
    By janzi9 in forum World of Warcraft General
    Replies: 11
    Last Post: 05-27-2006, 06:56 PM
  4. Gimped Thread!
    By janzi9 in forum Community Chat
    Replies: 5
    Last Post: 05-24-2006, 11:36 PM
  5. Pimped Thread!
    By janzi9 in forum Community Chat
    Replies: 1
    Last Post: 05-24-2006, 03:49 AM
All times are GMT -5. The time now is 05:50 AM. Powered by vBulletin® Version 4.2.3
Copyright © 2025 vBulletin Solutions, Inc. All rights reserved. User Alert System provided by Advanced User Tagging (Pro) - vBulletin Mods & Addons Copyright © 2025 DragonByte Technologies Ltd.
Google Authenticator verification provided by Two-Factor Authentication (Free) - vBulletin Mods & Addons Copyright © 2025 DragonByte Technologies Ltd.
Digital Point modules: Sphinx-based search