D
Dakkar
I made a program like i showed below and i used
this.Visible = false;
line to make it invisible but it doesnt work
where did i make mistake ?
here is my code
[code:1:c303f80ced]
using System;
using System.Windows.Forms;
using System.Drawing;
using System.Diagnostics;
public class sylagent : Form
{
private Process[] myproc;
private Timer t1;
private FileVersionInfo myinfo;
private int count;
private String program;
private String prog;
public sylagent()
{
myproc = Process.GetProcesses();
count = 0;
this.Size = new Size(300, 300);
this.Location = new Point(100, 100);
this.Visible = false;
kontrolevent();
}
public void kontrolevent()
{
this.t1 = new Timer();
this.t1.Interval = 1000;
this.t1.Start();
this.t1.Tick += new EventHandler(t1_tick);
}
protected override void Dispose(bool Disposing)
{
Process[] procuo = Process.GetProcesses();
for (int i = 0; i < procuo.Length-3; i++)
{
if
(procuo.ProcessName.Equals("client"))
{
procuo.Kill();
}
}
base.Dispose(true);
}
public void t1_tick(object sender, EventArgs e)
{
for (int i = 0; i < myproc.Length-4; i++)
{
if (! this.myproc.HasExited)
{
if (this.myproc.MainModule.FileName !=
null)
{
this.program =
this.myproc.MainModule.FileName.ToString();
if (this.program[0] == 'C' ||
this.program[0] == 'D' || this.program[0] == 'E' ||
this.program[0] == 'F' || this.program[0] ==
'G')
{
prog =
myproc.MainModule.FileName.ToString();
this.myinfo =
FileVersionInfo.GetVersionInfo(prog);
if (this.myinfo.OriginalFilename !=
null)
{
if
(this.myinfo.OriginalFilename.Equals("connector.exe"))
{
this.count++;
}
}
}
}
}
}
if (this.count != 1)
{
this.Close();
}
this.count = 0;
}
public static void Main()
{
Application.Run(new sylagent());
}
}
[/code:1:c303f80ced]
this.Visible = false;
line to make it invisible but it doesnt work
where did i make mistake ?
here is my code
[code:1:c303f80ced]
using System;
using System.Windows.Forms;
using System.Drawing;
using System.Diagnostics;
public class sylagent : Form
{
private Process[] myproc;
private Timer t1;
private FileVersionInfo myinfo;
private int count;
private String program;
private String prog;
public sylagent()
{
myproc = Process.GetProcesses();
count = 0;
this.Size = new Size(300, 300);
this.Location = new Point(100, 100);
this.Visible = false;
kontrolevent();
}
public void kontrolevent()
{
this.t1 = new Timer();
this.t1.Interval = 1000;
this.t1.Start();
this.t1.Tick += new EventHandler(t1_tick);
}
protected override void Dispose(bool Disposing)
{
Process[] procuo = Process.GetProcesses();
for (int i = 0; i < procuo.Length-3; i++)
{
if
(procuo.ProcessName.Equals("client"))
{
procuo.Kill();
}
}
base.Dispose(true);
}
public void t1_tick(object sender, EventArgs e)
{
for (int i = 0; i < myproc.Length-4; i++)
{
if (! this.myproc.HasExited)
{
if (this.myproc.MainModule.FileName !=
null)
{
this.program =
this.myproc.MainModule.FileName.ToString();
if (this.program[0] == 'C' ||
this.program[0] == 'D' || this.program[0] == 'E' ||
this.program[0] == 'F' || this.program[0] ==
'G')
{
prog =
myproc.MainModule.FileName.ToString();
this.myinfo =
FileVersionInfo.GetVersionInfo(prog);
if (this.myinfo.OriginalFilename !=
null)
{
if
(this.myinfo.OriginalFilename.Equals("connector.exe"))
{
this.count++;
}
}
}
}
}
}
if (this.count != 1)
{
this.Close();
}
this.count = 0;
}
public static void Main()
{
Application.Run(new sylagent());
}
}
[/code:1:c303f80ced]