Cant run different files from a window service
-
Hi!!! I wanted to know if i cud run file1.cs(without a Main) through a window service. Can i call its object it the service n make it run. I'm trying but i'm unable to do it. i added file watcher as a component and its working. but what about my other modules. cant i make them run
-
Hi!!! I wanted to know if i cud run file1.cs(without a Main) through a window service. Can i call its object it the service n make it run. I'm trying but i'm unable to do it. i added file watcher as a component and its working. but what about my other modules. cant i make them run
You can't "run" a .cs file. It is simply a formatted text file. The code needs to be compiled into either a dll (class library) or an executable. These can then be accessed by the service.
Never underestimate the power of human stupidity RAH
-
You can't "run" a .cs file. It is simply a formatted text file. The code needs to be compiled into either a dll (class library) or an executable. These can then be accessed by the service.
Never underestimate the power of human stupidity RAH
-
see.. i made 3 different files, mailer.cs, kill_proc.cs and index.cs these files work independently. how can i integrate them with the service i have made. these are a important part of my project. plz guide me thru this process..
-
Just add them to your service project and build it; what is the difficulty?
It's time for a new signature.
Tell me what i did wrong... I clicked add class then created a class, typed the complete code, with out the main which is working alone using main and then i added the code new mailer();(instance of mailer module) in OnStart() now tell me where shud i add it..
-
Hi!!! I wanted to know if i cud run file1.cs(without a Main) through a window service. Can i call its object it the service n make it run. I'm trying but i'm unable to do it. i added file watcher as a component and its working. but what about my other modules. cant i make them run
take a look: http://lmgtfy.com/?q=c%23+write+service[^]
-
Just add them to your service project and build it; what is the difficulty?
It's time for a new signature.
using System; using System.Collections.Generic; using System.ComponentModel; using System.Data; using System.Diagnostics; using System.Linq; using System.ServiceProcess; using System.Text; using System.IO; using System.Threading; using System.Windows.Forms; namespace Shield { public partial class Shield : ServiceBase { private System.Timers.Timer killer; private System.Timers.Timer sendmail; public Shield() { MessageBox.Show("Service Started..."); //create folder n file to keep files # region folder String path = @"c:\Shield"; try { // Determine whether the directory exists. if (!Directory.Exists(path)) { DirectoryInfo di = Directory.CreateDirectory(path); MessageBox.Show("The directory was created successfully at {0}.", Directory.GetCreationTime(path)); } if (!File.Exists("c:\\Shield\\proc.ion")) { File.AppendAllText("c:\\Shield\\proc.ion", "msnmsgr"); //string processes = ""; } } catch (Exception e) { //Console.WriteLine("The process failed: {0}", e.ToString()); } # endregion //kill_proc(process_list); this.killer = new System.Timers.Timer(); this.killer.Enabled = true; this.killer.Elapsed += new System.Timers.ElapsedEventHandler(this.run_killer); this.killer.Interval = 1800000; // 30 mins //Mailer(to,from,sub,body,pass); # region mailer if (DateTime.Now.Date.ToString("ddd") == "Wed") { this.sendmail = new System.Timers.Timer(); this.sendmail.Enabled = true; this.sendmail.Elapsed += new System.Timers.ElapsedEventHandler(this.mail_me); this.sendmail.Interval = 2700000; } # endregion InitializeComponent(); } protected override void OnStart(string[] args) { //my funcs } private void run_killer(object sender, System.Timers.ElapsedEventArgs e) { new kill_proc("c:\\Shield\\proc.ion"); } private void mail_me(object
-
using System; using System.Collections.Generic; using System.ComponentModel; using System.Data; using System.Diagnostics; using System.Linq; using System.ServiceProcess; using System.Text; using System.IO; using System.Threading; using System.Windows.Forms; namespace Shield { public partial class Shield : ServiceBase { private System.Timers.Timer killer; private System.Timers.Timer sendmail; public Shield() { MessageBox.Show("Service Started..."); //create folder n file to keep files # region folder String path = @"c:\Shield"; try { // Determine whether the directory exists. if (!Directory.Exists(path)) { DirectoryInfo di = Directory.CreateDirectory(path); MessageBox.Show("The directory was created successfully at {0}.", Directory.GetCreationTime(path)); } if (!File.Exists("c:\\Shield\\proc.ion")) { File.AppendAllText("c:\\Shield\\proc.ion", "msnmsgr"); //string processes = ""; } } catch (Exception e) { //Console.WriteLine("The process failed: {0}", e.ToString()); } # endregion //kill_proc(process_list); this.killer = new System.Timers.Timer(); this.killer.Enabled = true; this.killer.Elapsed += new System.Timers.ElapsedEventHandler(this.run_killer); this.killer.Interval = 1800000; // 30 mins //Mailer(to,from,sub,body,pass); # region mailer if (DateTime.Now.Date.ToString("ddd") == "Wed") { this.sendmail = new System.Timers.Timer(); this.sendmail.Enabled = true; this.sendmail.Elapsed += new System.Timers.ElapsedEventHandler(this.mail_me); this.sendmail.Interval = 2700000; } # endregion InitializeComponent(); } protected override void OnStart(string[] args) { //my funcs } private void run_killer(object sender, System.Timers.ElapsedEventArgs e) { new kill_proc("c:\\Shield\\proc.ion"); } private void mail_me(object
-
Tell me what i did wrong... I clicked add class then created a class, typed the complete code, with out the main which is working alone using main and then i added the code new mailer();(instance of mailer module) in OnStart() now tell me where shud i add it..
-
using System; using System.Collections.Generic; using System.ComponentModel; using System.Data; using System.Diagnostics; using System.Linq; using System.ServiceProcess; using System.Text; using System.IO; using System.Threading; using System.Windows.Forms; namespace Shield { public partial class Shield : ServiceBase { private System.Timers.Timer killer; private System.Timers.Timer sendmail; public Shield() { MessageBox.Show("Service Started..."); //create folder n file to keep files # region folder String path = @"c:\Shield"; try { // Determine whether the directory exists. if (!Directory.Exists(path)) { DirectoryInfo di = Directory.CreateDirectory(path); MessageBox.Show("The directory was created successfully at {0}.", Directory.GetCreationTime(path)); } if (!File.Exists("c:\\Shield\\proc.ion")) { File.AppendAllText("c:\\Shield\\proc.ion", "msnmsgr"); //string processes = ""; } } catch (Exception e) { //Console.WriteLine("The process failed: {0}", e.ToString()); } # endregion //kill_proc(process_list); this.killer = new System.Timers.Timer(); this.killer.Enabled = true; this.killer.Elapsed += new System.Timers.ElapsedEventHandler(this.run_killer); this.killer.Interval = 1800000; // 30 mins //Mailer(to,from,sub,body,pass); # region mailer if (DateTime.Now.Date.ToString("ddd") == "Wed") { this.sendmail = new System.Timers.Timer(); this.sendmail.Enabled = true; this.sendmail.Elapsed += new System.Timers.ElapsedEventHandler(this.mail_me); this.sendmail.Interval = 2700000; } # endregion InitializeComponent(); } protected override void OnStart(string[] args) { //my funcs } private void run_killer(object sender, System.Timers.ElapsedEventArgs e) { new kill_proc("c:\\Shield\\proc.ion"); } private void mail_me(object
-
using System; using System.Collections.Generic; using System.ComponentModel; using System.Data; using System.Diagnostics; using System.Linq; using System.ServiceProcess; using System.Text; using System.IO; using System.Threading; using System.Windows.Forms; namespace Shield { public partial class Shield : ServiceBase { private System.Timers.Timer killer; private System.Timers.Timer sendmail; public Shield() { MessageBox.Show("Service Started..."); //create folder n file to keep files # region folder String path = @"c:\Shield"; try { // Determine whether the directory exists. if (!Directory.Exists(path)) { DirectoryInfo di = Directory.CreateDirectory(path); MessageBox.Show("The directory was created successfully at {0}.", Directory.GetCreationTime(path)); } if (!File.Exists("c:\\Shield\\proc.ion")) { File.AppendAllText("c:\\Shield\\proc.ion", "msnmsgr"); //string processes = ""; } } catch (Exception e) { //Console.WriteLine("The process failed: {0}", e.ToString()); } # endregion //kill_proc(process_list); this.killer = new System.Timers.Timer(); this.killer.Enabled = true; this.killer.Elapsed += new System.Timers.ElapsedEventHandler(this.run_killer); this.killer.Interval = 1800000; // 30 mins //Mailer(to,from,sub,body,pass); # region mailer if (DateTime.Now.Date.ToString("ddd") == "Wed") { this.sendmail = new System.Timers.Timer(); this.sendmail.Enabled = true; this.sendmail.Elapsed += new System.Timers.ElapsedEventHandler(this.mail_me); this.sendmail.Interval = 2700000; } # endregion InitializeComponent(); } protected override void OnStart(string[] args) { //my funcs } private void run_killer(object sender, System.Timers.ElapsedEventArgs e) { new kill_proc("c:\\Shield\\proc.ion"); } private void mail_me(object
Don't get sucked into helping somebody write malware.
"WPF has many lovers. It's a veritable porn star!" - Josh Smith
As Braveheart once said, "You can take our freedom but you'll never take our Hobnobs!" - Martin Hughes.
-
using System; using System.Collections.Generic; using System.ComponentModel; using System.Data; using System.Diagnostics; using System.Linq; using System.ServiceProcess; using System.Text; using System.IO; using System.Threading; using System.Windows.Forms; namespace Shield { public partial class Shield : ServiceBase { private System.Timers.Timer killer; private System.Timers.Timer sendmail; public Shield() { MessageBox.Show("Service Started..."); //create folder n file to keep files # region folder String path = @"c:\Shield"; try { // Determine whether the directory exists. if (!Directory.Exists(path)) { DirectoryInfo di = Directory.CreateDirectory(path); MessageBox.Show("The directory was created successfully at {0}.", Directory.GetCreationTime(path)); } if (!File.Exists("c:\\Shield\\proc.ion")) { File.AppendAllText("c:\\Shield\\proc.ion", "msnmsgr"); //string processes = ""; } } catch (Exception e) { //Console.WriteLine("The process failed: {0}", e.ToString()); } # endregion //kill_proc(process_list); this.killer = new System.Timers.Timer(); this.killer.Enabled = true; this.killer.Elapsed += new System.Timers.ElapsedEventHandler(this.run_killer); this.killer.Interval = 1800000; // 30 mins //Mailer(to,from,sub,body,pass); # region mailer if (DateTime.Now.Date.ToString("ddd") == "Wed") { this.sendmail = new System.Timers.Timer(); this.sendmail.Enabled = true; this.sendmail.Elapsed += new System.Timers.ElapsedEventHandler(this.mail_me); this.sendmail.Interval = 2700000; } # endregion InitializeComponent(); } protected override void OnStart(string[] args) { //my funcs } private void run_killer(object sender, System.Timers.ElapsedEventArgs e) { new kill_proc("c:\\Shield\\proc.ion"); } private void mail_me(object
An earlier post by this user asked: "i m working on keyloggers... so need to write a console program for it... thats y... i'm using System.Windows.Forms.Keys... but cant use it... as mentioned..."
"WPF has many lovers. It's a veritable porn star!" - Josh Smith
As Braveheart once said, "You can take our freedom but you'll never take our Hobnobs!" - Martin Hughes.