Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 104237
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 11, 20262026-05-11T01:15:00+00:00 2026-05-11T01:15:00+00:00

Alright so here is the deal. I am trying to make a application that’s

  • 0

Alright so here is the deal. I am trying to make a application that’s a GUI application yet has no GUI. So when the application starts, it has a small form with a login screen (I have done this part).

This the code for the main() in which the form runs but as soon as it is closed, I dispose of it.

static void Main()  {            Application.EnableVisualStyles();     Application.SetCompatibleTextRenderingDefault(false);                             //Create an instance of form1     Form1 form1 = new Form1();               Application.Run(form1);      if(form1.isLoggedIn)      {                      filename = Path.Combine(Environment.GetFolderPath(System.Environment.SpecialFolder.CommonApplicationData), DateTime.Now.ToString('ddMMyyhhmm') + '-' + form1.username);         Flow palm = new Flow(new FlowArguments(form1.username, filename));         MessageBox.Show('Thankyou, exiting...');         form1.Dispose();                     }  } 

So as you can see after the form is closed, the main continues on the condition if someone is logged in. If you look carefully, there’s a instance to the Flow class that’s created.

This is a very short class and here we go:

public class Flow  {     //global variables     FlowArguments FlowArgs;     System.Threading.Timer tm;      //constructor     public Flow(FlowArguments fmg)      {         FlowArgs = fmg;          tm = new System.Threading.Timer(Tick, null,                                              System.Threading.Timeout.Infinite, 10000);           using(StreamWriter sw = new StreamWriter(FlowArgs.Filename))          {                         //sw.writelines that SO doesnt really care for.                        }          //enable the timer         tm.Change(0, 100);     }      public void Tick(object State)      {         Console.WriteLine('Hello');         //a bunch of SteamWriter writeline methods that SO doesnt care for.     }      public void WriteProcesses(StreamWriter sw, DateTime dw)      {         var localAll = Process.GetProcesses().Where(o => o.ProcessName.ToLower() != 'svchost');         foreach(Process p in localAll)          {             sw.WriteLine('@' + p.ProcessName +                          '[' + dw.ToString('ddMMyyhhmm') + ']' +                          '[' + FlowArgs.Username + ']');         }                   } } 

As you can see I do start the timer. But since this uses System.Threading.Timer (because I read somewhere that the Form.Timer really isn’t appropriate) it runs on a threadpool (as per MSDN) but while this is happening the main form has now exited out of Main() and hence the program is closed.

What are my possible solutions? This timer will run every 10 minutes (grabbing the processes). After the GUI is closed, I plan on making a system icon tray that the user can use to close the program.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. 2026-05-11T01:15:00+00:00Added an answer on May 11, 2026 at 1:15 am

    If you want to make the foreground thread wait you can use a WaitHandle.

    http://msdn.microsoft.com/en-us/library/system.threading.waithandle.aspx

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Ask A Question

Stats

  • Questions 62k
  • Answers 62k
  • Best Answers 0
  • User 1
  • Popular
  • Answers
  • Editorial Team

    How to approach applying for a job at a company ...

    • 7 Answers
  • Editorial Team

    How to handle personal stress caused by utterly incompetent and ...

    • 5 Answers
  • Editorial Team

    What is a programmer’s life like?

    • 5 Answers
  • added an answer By putting the text inside a DIV with a style… May 11, 2026 at 10:14 am
  • added an answer Yes, you can install multiple versions of Xcode. They will… May 11, 2026 at 10:14 am
  • added an answer Exceptions should be used for exceptional conditions. I would say… May 11, 2026 at 10:14 am

Related Questions

Alright so here is the deal. I am trying to make a application that's
Alright so here is my issue. I'm working a game engine that will eventually
Alright so I have this C++ image capturing class. I was wondering if I
Alright. So I figure it's about time I get into unit testing, since everyone's
Alright. So I have a very large amount of binary data (let's say, 10GB)
Alright, so I have a query that looks like this: SELECT `orders`.*, GROUP_CONCAT( CONCAT(
Alright, so I'm trying out C++ for the first time, as it looks like
Alright, currently I have my SWF hitting a php file that will go and
Alright, I have been doing the following (variable names have been changed): FileInputStream fis
Alright, I'm trying to read a comma delimited file and then put that into

Trending Tags

analytics british company computer developers django employee employer english facebook french google interview javascript language life php programmer programs salary

Top Members

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.