473,750 Members | 2,190 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Start a process

GTi
I have small program that always must be running when a user is logged on.
Since users can close this program I must create a program that always check
if this program is running.
So I created a program in C# (my first!!) and it works with one major
problem.
This program detects when the desktop program is not running and starts it
again. All works as expected
BUT
The desktop program is running as a SYSTEM user.
That is not what I wanted....
So I need to find a way to start this desktop program as the current logged
on user (it can be different users)

Can this be done in C#?

GTi


using System;
using System.Collecti ons;
using System.Componen tModel;
using System.Data;
using System.Diagnost ics;
using System.ServiceP rocess;
using System.Runtime. InteropServices ;
using System.Windows. Forms;
using System.Xml;

public class Win32
{
public const int WM_SYSCOMMAND = 0x0112;
public const int SC_CLOSE = 0xF060;
[DllImport("user 32.dll")] public static extern int FindWindow(stri ng
lpClassName, string lpWindowName);
[DllImport("user 32.dll")] public static extern int SendMessage(int hWnd,
uint Msg, int wParam, int lParam);
[DllImport("user 32.dll")] public static extern int GetDesktopWindo w();
}
namespace attenWat
{
public class Service1 : System.ServiceP rocess.ServiceB ase
{

private System.Timers.T imer timer1=null;
private System.Timers.T imer newFileVersionC hecker=null;
private System.Componen tModel.IContain er components=null ;
public Service1()
{
InitializeCompo nent();
}

// The main entry point for the process
static void Main()
{
System.ServiceP rocess.ServiceB ase[] ServicesToRun;
ServicesToRun = new System.ServiceP rocess.ServiceB ase[] { new Service1() };
System.ServiceP rocess.ServiceB ase.Run(Service sToRun);
}

/// <summary>
/// Required method for Designer support - do not modify
/// the contents of this method with the code editor.
/// </summary>
private void InitializeCompo nent()
{
this.timer1 = new System.Timers.T imer();
this.newFileVer sionChecker = new System.Timers.T imer();
((System.Compon entModel.ISuppo rtInitialize)(t his.timer1)).Be ginInit();
((System.Compon entModel.ISuppo rtInitialize)(t his.newFileVers ionChecker)).Be ginInit();
// timer1
this.timer1.Ena bled = true;
this.timer1.Int erval = 10000;
this.timer1.Ela psed += new
System.Timers.E lapsedEventHand ler(this.timer1 _Elapsed_1);
// newFileVersionC hecker
this.newFileVer sionChecker.Ena bled = true;
this.newFileVer sionChecker.Int erval = 60000;
this.newFileVer sionChecker.Ela psed += new
System.Timers.E lapsedEventHand ler(this.newFil eVersionChecker _Elapsed);
// Service1
this.ServiceNam e = "AttendanceServ ice";
((System.Compon entModel.ISuppo rtInitialize)(t his.timer1)).En dInit();
((System.Compon entModel.ISuppo rtInitialize)(t his.newFileVers ionChecker)).En dInit();
}

/// <summary>
/// Clean up any resources being used.
/// </summary>
protected override void Dispose( bool disposing )
{
if( disposing )
{
if(components != null)
{
components.Disp ose();
}
}
base.Dispose( disposing );
}

/// <summary>
/// Set things in motion so your service can do its work.
/// </summary>

protected override void OnStart(string[] args)
{
// TODO: Add code here to start your service.
}
/// <summary>
/// Stop this service.
/// </summary>
protected override void OnStop()
{
// TODO: Add code here to perform any tear-down necessary to stop your
service.
}

////////////////////////////////////////////////////////////////////////////////////////
private void timer1_Elapsed_ 1(object sender, System.Timers.E lapsedEventArgs
e)
{
if((Win32.GetDe sktopWindow()!= 0) &&
(Win32.FindWind ow("TUN.Attenda nce.Windows.Cla ss",null)==0) )
{
Process myProcess = new Process();
try
{
string myDocumentsPath =
Environment.Get FolderPath(Envi ronment.Special Folder.ProgramF iles);
// need to find a way to start this program in the current user environment
myProcess.Start Info.Verb = "Open";
myProcess.Start Info.UseShellEx ecute = true;
// myProcess.Start Info.FileName = myDocumentsPath + \\tun\\attendan ce.exe;
// myProcess.Start ();
}
catch(Win32Exce ption err)
{
string dummyString = err.Message; // Avoid warning message
// MessageBox.Show (err.Message+"\ r\n"+myProcess. StartInfo.FileN ame, "Check
the path.", MessageBoxButto ns.OK);
}
}
}

private void newFileVersionC hecker_Elapsed( object sender,
System.Timers.E lapsedEventArgs e)
{
// Application.Sta rtupPath;
}
}
}
Nov 16 '05 #1
12 4099
How is your desktop program being started at first? Is it being started by
the detector program? Or do you have a short cut to the all users/startup
folder?

--
in**@dowhileloo p.com
http://dowhileloop.com website development
http://publicjoe.dowhileloop.com -- C# Tutorials

"GTi" <gt*@gti.com> wrote in message news:42******** @news.wineasy.s e...
I have small program that always must be running when a user is logged on.
Since users can close this program I must create a program that always check if this program is running.
So I created a program in C# (my first!!) and it works with one major
problem.
This program detects when the desktop program is not running and starts it
again. All works as expected
BUT
The desktop program is running as a SYSTEM user.
That is not what I wanted....
So I need to find a way to start this desktop program as the current logged on user (it can be different users)

Can this be done in C#?

GTi


using System;
using System.Collecti ons;
using System.Componen tModel;
using System.Data;
using System.Diagnost ics;
using System.ServiceP rocess;
using System.Runtime. InteropServices ;
using System.Windows. Forms;
using System.Xml;

public class Win32
{
public const int WM_SYSCOMMAND = 0x0112;
public const int SC_CLOSE = 0xF060;
[DllImport("user 32.dll")] public static extern int FindWindow(stri ng
lpClassName, string lpWindowName);
[DllImport("user 32.dll")] public static extern int SendMessage(int hWnd,
uint Msg, int wParam, int lParam);
[DllImport("user 32.dll")] public static extern int GetDesktopWindo w();
}
namespace attenWat
{
public class Service1 : System.ServiceP rocess.ServiceB ase
{

private System.Timers.T imer timer1=null;
private System.Timers.T imer newFileVersionC hecker=null;
private System.Componen tModel.IContain er components=null ;
public Service1()
{
InitializeCompo nent();
}

// The main entry point for the process
static void Main()
{
System.ServiceP rocess.ServiceB ase[] ServicesToRun;
ServicesToRun = new System.ServiceP rocess.ServiceB ase[] { new Service1() }; System.ServiceP rocess.ServiceB ase.Run(Service sToRun);
}

/// <summary>
/// Required method for Designer support - do not modify
/// the contents of this method with the code editor.
/// </summary>
private void InitializeCompo nent()
{
this.timer1 = new System.Timers.T imer();
this.newFileVer sionChecker = new System.Timers.T imer();
((System.Compon entModel.ISuppo rtInitialize)(t his.timer1)).Be ginInit();
((System.Compon entModel.ISuppo rtInitialize)(t his.newFileVers ionChecker)).Be g
inInit(); // timer1
this.timer1.Ena bled = true;
this.timer1.Int erval = 10000;
this.timer1.Ela psed += new
System.Timers.E lapsedEventHand ler(this.timer1 _Elapsed_1);
// newFileVersionC hecker
this.newFileVer sionChecker.Ena bled = true;
this.newFileVer sionChecker.Int erval = 60000;
this.newFileVer sionChecker.Ela psed += new
System.Timers.E lapsedEventHand ler(this.newFil eVersionChecker _Elapsed);
// Service1
this.ServiceNam e = "AttendanceServ ice";
((System.Compon entModel.ISuppo rtInitialize)(t his.timer1)).En dInit();
((System.Compon entModel.ISuppo rtInitialize)(t his.newFileVers ionChecker)).En d
Init(); }

/// <summary>
/// Clean up any resources being used.
/// </summary>
protected override void Dispose( bool disposing )
{
if( disposing )
{
if(components != null)
{
components.Disp ose();
}
}
base.Dispose( disposing );
}

/// <summary>
/// Set things in motion so your service can do its work.
/// </summary>

protected override void OnStart(string[] args)
{
// TODO: Add code here to start your service.
}
/// <summary>
/// Stop this service.
/// </summary>
protected override void OnStop()
{
// TODO: Add code here to perform any tear-down necessary to stop your
service.
}

////////////////////////////////////////////////////////////////////////////
//////////// private void timer1_Elapsed_ 1(object sender, System.Timers.E lapsedEventArgs e)
{
if((Win32.GetDe sktopWindow()!= 0) &&
(Win32.FindWind ow("TUN.Attenda nce.Windows.Cla ss",null)==0) )
{
Process myProcess = new Process();
try
{
string myDocumentsPath =
Environment.Get FolderPath(Envi ronment.Special Folder.ProgramF iles);
// need to find a way to start this program in the current user environment myProcess.Start Info.Verb = "Open";
myProcess.Start Info.UseShellEx ecute = true;
// myProcess.Start Info.FileName = myDocumentsPath + \\tun\\attendan ce.exe;
// myProcess.Start ();
}
catch(Win32Exce ption err)
{
string dummyString = err.Message; // Avoid warning message
// MessageBox.Show (err.Message+"\ r\n"+myProcess. StartInfo.FileN ame, "Check
the path.", MessageBoxButto ns.OK);
}
}
}

private void newFileVersionC hecker_Elapsed( object sender,
System.Timers.E lapsedEventArgs e)
{
// Application.Sta rtupPath;
}
}
}

Nov 16 '05 #2
Landi has a good point... if your "detector" app is started as part of a
startup sequence, and not as a service, then it will run under the
credentials of the current user, which means that it will start any
downstream app as the current user.

--
--- Nick Malik [Microsoft]
MCSD, CFPS, Certified Scrummaster
http://blogs.msdn.com/nickmalik

Disclaimer: Opinions expressed in this forum are my own, and not
representative of my employer.
I do not answer questions on behalf of my employer. I'm just a
programmer helping programmers.
--
"GTi" <gt*@gti.com> wrote in message news:42******** @news.wineasy.s e...
I have small program that always must be running when a user is logged on.
Since users can close this program I must create a program that always
check if this program is running.
So I created a program in C# (my first!!) and it works with one major
problem.
This program detects when the desktop program is not running and starts it
again. All works as expected
BUT
The desktop program is running as a SYSTEM user.
That is not what I wanted....
So I need to find a way to start this desktop program as the current
logged on user (it can be different users)

Can this be done in C#?

GTi


using System;
using System.Collecti ons;
using System.Componen tModel;
using System.Data;
using System.Diagnost ics;
using System.ServiceP rocess;
using System.Runtime. InteropServices ;
using System.Windows. Forms;
using System.Xml;

public class Win32
{
public const int WM_SYSCOMMAND = 0x0112;
public const int SC_CLOSE = 0xF060;
[DllImport("user 32.dll")] public static extern int FindWindow(stri ng
lpClassName, string lpWindowName);
[DllImport("user 32.dll")] public static extern int SendMessage(int hWnd,
uint Msg, int wParam, int lParam);
[DllImport("user 32.dll")] public static extern int GetDesktopWindo w();
}
namespace attenWat
{
public class Service1 : System.ServiceP rocess.ServiceB ase
{

private System.Timers.T imer timer1=null;
private System.Timers.T imer newFileVersionC hecker=null;
private System.Componen tModel.IContain er components=null ;
public Service1()
{
InitializeCompo nent();
}

// The main entry point for the process
static void Main()
{
System.ServiceP rocess.ServiceB ase[] ServicesToRun;
ServicesToRun = new System.ServiceP rocess.ServiceB ase[] { new
Service1() };
System.ServiceP rocess.ServiceB ase.Run(Service sToRun);
}

/// <summary>
/// Required method for Designer support - do not modify
/// the contents of this method with the code editor.
/// </summary>
private void InitializeCompo nent()
{
this.timer1 = new System.Timers.T imer();
this.newFileVer sionChecker = new System.Timers.T imer();
((System.Compon entModel.ISuppo rtInitialize)(t his.timer1)).Be ginInit();
((System.Compon entModel.ISuppo rtInitialize)(t his.newFileVers ionChecker)).Be ginInit();
// timer1
this.timer1.Ena bled = true;
this.timer1.Int erval = 10000;
this.timer1.Ela psed += new
System.Timers.E lapsedEventHand ler(this.timer1 _Elapsed_1);
// newFileVersionC hecker
this.newFileVer sionChecker.Ena bled = true;
this.newFileVer sionChecker.Int erval = 60000;
this.newFileVer sionChecker.Ela psed += new
System.Timers.E lapsedEventHand ler(this.newFil eVersionChecker _Elapsed);
// Service1
this.ServiceNam e = "AttendanceServ ice";
((System.Compon entModel.ISuppo rtInitialize)(t his.timer1)).En dInit();
((System.Compon entModel.ISuppo rtInitialize)(t his.newFileVers ionChecker)).En dInit();
}

/// <summary>
/// Clean up any resources being used.
/// </summary>
protected override void Dispose( bool disposing )
{
if( disposing )
{
if(components != null)
{
components.Disp ose();
}
}
base.Dispose( disposing );
}

/// <summary>
/// Set things in motion so your service can do its work.
/// </summary>

protected override void OnStart(string[] args)
{
// TODO: Add code here to start your service.
}
/// <summary>
/// Stop this service.
/// </summary>
protected override void OnStop()
{
// TODO: Add code here to perform any tear-down necessary to stop your
service.
}

////////////////////////////////////////////////////////////////////////////////////////
private void timer1_Elapsed_ 1(object sender,
System.Timers.E lapsedEventArgs e)
{
if((Win32.GetDe sktopWindow()!= 0) &&
(Win32.FindWind ow("TUN.Attenda nce.Windows.Cla ss",null)==0) )
{
Process myProcess = new Process();
try
{
string myDocumentsPath =
Environment.Get FolderPath(Envi ronment.Special Folder.ProgramF iles);
// need to find a way to start this program in the current user
environment
myProcess.Start Info.Verb = "Open";
myProcess.Start Info.UseShellEx ecute = true;
// myProcess.Start Info.FileName = myDocumentsPath + \\tun\\attendan ce.exe;
// myProcess.Start ();
}
catch(Win32Exce ption err)
{
string dummyString = err.Message; // Avoid warning message
// MessageBox.Show (err.Message+"\ r\n"+myProcess. StartInfo.FileN ame, "Check
the path.", MessageBoxButto ns.OK);
}
}
}

private void newFileVersionC hecker_Elapsed( object sender,
System.Timers.E lapsedEventArgs e)
{
// Application.Sta rtupPath;
}
}
}

Nov 16 '05 #3
GTi
The detector is a windows service.
The desktop program is started by the registry RUN key.

So the detector is running under the SERVICE user
and the desktop program is running as the logged on user.

Any idea how the detector can start a progrm running
as the logged on user without knowing the user/password.
"Nick Malik [Microsoft]" <ni*******@hotm ail.nospam.com> skrev i melding
news:Za******** ************@co mcast.com...
Landi has a good point... if your "detector" app is started as part of a
startup sequence, and not as a service, then it will run under the
credentials of the current user, which means that it will start any
downstream app as the current user.

--
--- Nick Malik [Microsoft]
MCSD, CFPS, Certified Scrummaster
http://blogs.msdn.com/nickmalik

Disclaimer: Opinions expressed in this forum are my own, and not
representative of my employer.
I do not answer questions on behalf of my employer. I'm just a
programmer helping programmers.
--
"GTi" <gt*@gti.com> wrote in message news:42******** @news.wineasy.s e...
I have small program that always must be running when a user is logged on.
Since users can close this program I must create a program that always
check if this program is running.
So I created a program in C# (my first!!) and it works with one major
problem.
This program detects when the desktop program is not running and starts
it again. All works as expected
BUT
The desktop program is running as a SYSTEM user.
That is not what I wanted....
So I need to find a way to start this desktop program as the current
logged on user (it can be different users)

Can this be done in C#?

GTi


using System;
using System.Collecti ons;
using System.Componen tModel;
using System.Data;
using System.Diagnost ics;
using System.ServiceP rocess;
using System.Runtime. InteropServices ;
using System.Windows. Forms;
using System.Xml;

public class Win32
{
public const int WM_SYSCOMMAND = 0x0112;
public const int SC_CLOSE = 0xF060;
[DllImport("user 32.dll")] public static extern int FindWindow(stri ng
lpClassName, string lpWindowName);
[DllImport("user 32.dll")] public static extern int SendMessage(int hWnd,
uint Msg, int wParam, int lParam);
[DllImport("user 32.dll")] public static extern int GetDesktopWindo w();
}
namespace attenWat
{
public class Service1 : System.ServiceP rocess.ServiceB ase
{

private System.Timers.T imer timer1=null;
private System.Timers.T imer newFileVersionC hecker=null;
private System.Componen tModel.IContain er components=null ;
public Service1()
{
InitializeCompo nent();
}

// The main entry point for the process
static void Main()
{
System.ServiceP rocess.ServiceB ase[] ServicesToRun;
ServicesToRun = new System.ServiceP rocess.ServiceB ase[] { new
Service1() };
System.ServiceP rocess.ServiceB ase.Run(Service sToRun);
}

/// <summary>
/// Required method for Designer support - do not modify
/// the contents of this method with the code editor.
/// </summary>
private void InitializeCompo nent()
{
this.timer1 = new System.Timers.T imer();
this.newFileVer sionChecker = new System.Timers.T imer();
((System.Compon entModel.ISuppo rtInitialize)(t his.timer1)).Be ginInit();
((System.Compon entModel.ISuppo rtInitialize)(t his.newFileVers ionChecker)).Be ginInit();
// timer1
this.timer1.Ena bled = true;
this.timer1.Int erval = 10000;
this.timer1.Ela psed += new
System.Timers.E lapsedEventHand ler(this.timer1 _Elapsed_1);
// newFileVersionC hecker
this.newFileVer sionChecker.Ena bled = true;
this.newFileVer sionChecker.Int erval = 60000;
this.newFileVer sionChecker.Ela psed += new
System.Timers.E lapsedEventHand ler(this.newFil eVersionChecker _Elapsed);
// Service1
this.ServiceNam e = "AttendanceServ ice";
((System.Compon entModel.ISuppo rtInitialize)(t his.timer1)).En dInit();
((System.Compon entModel.ISuppo rtInitialize)(t his.newFileVers ionChecker)).En dInit();
}

/// <summary>
/// Clean up any resources being used.
/// </summary>
protected override void Dispose( bool disposing )
{
if( disposing )
{
if(components != null)
{
components.Disp ose();
}
}
base.Dispose( disposing );
}

/// <summary>
/// Set things in motion so your service can do its work.
/// </summary>

protected override void OnStart(string[] args)
{
// TODO: Add code here to start your service.
}
/// <summary>
/// Stop this service.
/// </summary>
protected override void OnStop()
{
// TODO: Add code here to perform any tear-down necessary to stop your
service.
}

////////////////////////////////////////////////////////////////////////////////////////
private void timer1_Elapsed_ 1(object sender,
System.Timers.E lapsedEventArgs e)
{
if((Win32.GetDe sktopWindow()!= 0) &&
(Win32.FindWind ow("TUN.Attenda nce.Windows.Cla ss",null)==0) )
{
Process myProcess = new Process();
try
{
string myDocumentsPath =
Environment.Get FolderPath(Envi ronment.Special Folder.ProgramF iles);
// need to find a way to start this program in the current user
environment
myProcess.Start Info.Verb = "Open";
myProcess.Start Info.UseShellEx ecute = true;
// myProcess.Start Info.FileName = myDocumentsPath +
\\tun\\attendan ce.exe;
// myProcess.Start ();
}
catch(Win32Exce ption err)
{
string dummyString = err.Message; // Avoid warning message
// MessageBox.Show (err.Message+"\ r\n"+myProcess. StartInfo.FileN ame,
"Check the path.", MessageBoxButto ns.OK);
}
}
}

private void newFileVersionC hecker_Elapsed( object sender,
System.Timers.E lapsedEventArgs e)
{
// Application.Sta rtupPath;
}
}
}


Nov 16 '05 #4

"GTi" <bi**@gates.com > wrote in message
news:uw******** *****@TK2MSFTNG P12.phx.gbl...
The detector is a windows service.
The desktop program is started by the registry RUN key.

So the detector is running under the SERVICE user
and the desktop program is running as the logged on user.

Any idea how the detector can start a progrm running
as the logged on user without knowing the user/password.


Yes, but you have to PInvoke "CreateProcessW ithToken" Win32 API supplying
the token handle of the interactive logon.

Willy.


Nov 16 '05 #5
GTi
"Willy Denoyette [MVP]" <wi************ *@telenet.be> skrev i melding
news:%2******** ********@TK2MSF TNGP10.phx.gbl. ..

"GTi" <bi**@gates.com > wrote in message
news:uw******** *****@TK2MSFTNG P12.phx.gbl...
The detector is a windows service.
The desktop program is started by the registry RUN key.

So the detector is running under the SERVICE user
and the desktop program is running as the logged on user.

Any idea how the detector can start a progrm running
as the logged on user without knowing the user/password.


Yes, but you have to PInvoke "CreateProcessW ithToken" Win32 API supplying
the token handle of the interactive logon.

Willy.

Willy,
Ok.... how?
Sorry, but I'm not that familiar with C# yet
And I have never used CreateProcessWi thToken before.
How can I get the hToken for the current Desktop User?

And why do I have to PInvoke(*) a Win32 function into C#
Why doesn't C# have this function available in the Namespace(*).
Looks like C# is not finish yet so it have to borrow win32 functions.

Any hints?
(*)
I'm not so familiar with all the C# expression yet, so if I use wrong
phrases please correct me.

GTi
Nov 16 '05 #6
Hello GTi,
The detector is a windows service.
The desktop program is started by the registry RUN key.


This is what Landi was suggesting you should change.

Don't run the detector as a windows service. Run it as a console app in the
backgroud using the same registry RUN key.

--
--- Nick Malik [Microsoft]
MCSD, CFPS, Certified Scrummaster
http://blogs.msdn.com/nickmalik

Disclaimer: Opinions expressed in this forum are my own, and not
representative of my employer.
I do not answer questions on behalf of my employer. I'm just a
programmer helping programmers.
--
"GTi" <bi**@gates.com > wrote in message
news:uw******** *****@TK2MSFTNG P12.phx.gbl...
Nov 16 '05 #7
GTi
"Nick Malik [Microsoft]" <ni*******@hotm ail.nospam.com> skrev i melding
news:2b******** ************@co mcast.com...
Hello GTi,
The detector is a windows service.
The desktop program is started by the registry RUN key.


This is what Landi was suggesting you should change.

Don't run the detector as a windows service. Run it as a console app in
the backgroud using the same registry RUN key.

--
--- Nick Malik [Microsoft]
MCSD, CFPS, Certified Scrummaster
http://blogs.msdn.com/nickmalik

Disclaimer: Opinions expressed in this forum are my own, and not
representative of my employer.
I do not answer questions on behalf of my employer. I'm just a
programmer helping programmers.
--
"GTi" <bi**@gates.com > wrote in message
news:uw******** *****@TK2MSFTNG P12.phx.gbl...


OK - then the detector is a non invisible window.
The desktop program will check if the detector is running,
If not started, then start the detector program.
Same to the detector program. If the desktop program is not
running, then start the desktop program.
In that way both will watch each other.

No I must find out how I create a window program in C#
It's easy with C++...

Any help?

Nov 16 '05 #8
GTi
"GTi" <bi**@gates.com > skrev i melding
news:Om******** *****@TK2MSFTNG P10.phx.gbl...
"Nick Malik [Microsoft]" <ni*******@hotm ail.nospam.com> skrev i melding
news:2b******** ************@co mcast.com...
Hello GTi,
The detector is a windows service.
The desktop program is started by the registry RUN key.


This is what Landi was suggesting you should change.

Don't run the detector as a windows service. Run it as a console app in
the backgroud using the same registry RUN key.

--
--- Nick Malik [Microsoft]
MCSD, CFPS, Certified Scrummaster
http://blogs.msdn.com/nickmalik

Disclaimer: Opinions expressed in this forum are my own, and not
representative of my employer.
I do not answer questions on behalf of my employer. I'm just a
programmer helping programmers.
--
"GTi" <bi**@gates.com > wrote in message
news:uw******** *****@TK2MSFTNG P12.phx.gbl...


OK - then the detector is a non invisible window.
The desktop program will check if the detector is running,
If not started, then start the detector program.
Same to the detector program. If the desktop program is not
running, then start the desktop program.
In that way both will watch each other.

No I must find out how I create a window program in C#
It's easy with C++...

Any help?



Ok I got it....
But how can I change the class name.
the class name for the application is
WindowsForms10. Window.8.app4
I want to change it to a more familiar name.

Nov 16 '05 #9
GTi
A litle correction:
OK - then the detector is a non visible window.

"GTi" <bi**@gates.com > skrev i melding
news:Om******** *****@TK2MSFTNG P10.phx.gbl...
"Nick Malik [Microsoft]" <ni*******@hotm ail.nospam.com> skrev i melding
news:2b******** ************@co mcast.com...
Hello GTi,
The detector is a windows service.
The desktop program is started by the registry RUN key.


This is what Landi was suggesting you should change.

Don't run the detector as a windows service. Run it as a console app in
the backgroud using the same registry RUN key.

--
--- Nick Malik [Microsoft]
MCSD, CFPS, Certified Scrummaster
http://blogs.msdn.com/nickmalik

Disclaimer: Opinions expressed in this forum are my own, and not
representative of my employer.
I do not answer questions on behalf of my employer. I'm just a
programmer helping programmers.
--
"GTi" <bi**@gates.com > wrote in message
news:uw******** *****@TK2MSFTNG P12.phx.gbl...


OK - then the detector is a non invisible window.
The desktop program will check if the detector is running,
If not started, then start the detector program.
Same to the detector program. If the desktop program is not
running, then start the desktop program.
In that way both will watch each other.

No I must find out how I create a window program in C#
It's easy with C++...

Any help?


Nov 16 '05 #10

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
5840
by: Mark Adams | last post by:
I am a relative newbie to MySQL. I had a Postfix+Courier+MySQL mail server running for several months. It took me a week or so to get it up and running in September. Now, I did a clean upgrade to Mandrake 9.2 and am reinstalling everything. This thing is kicking my ass and I can't seem to get past it. I could really use some help if anybody has any. Just for reference, this was my primary source for information on installation and...
1
2044
by: Marc | last post by:
I want to write a C#/ASP.NET application where a user can go to a web page, start running a job, close their browser, and then come back later and see the results. The purpose for this application is for a user to be able to use a page on our intranet to start running a time-consuming reporting and analysis job. I'm not sure how to start a process in ASP.NET and then "detach" it, or how to check that it's still running later. I think that maybe...
1
2379
by: Sin Jeong-hun | last post by:
Many applications need to lanch a web browser to show its homepage to users. I used System.Diagnosis.Process.Start("http://www.google.com"); Or I launched other application like System.Diagnosis.Process.Start("notepad.exe"); But the problems is the application freezes for a couple of seconds till the application starts. Is there any way to start a process asynchronously, so that my application wouldn't freeze? Should I create a new...
6
6845
by: Dmitri Shvetsov | last post by:
Hi, Can I start an external process from the Web Service? I'm using a code, compiler keeps silence, compiles ok and starts the project. When I trace in Debugger it doesn't start an external process. That's strange for me. I understand that it should be a new shell, but why I can't start it? Is it need to have a Windows application to start an external process? I created a very long batch files and a complicated script to work with...
4
14207
by: Yiu | last post by:
upgent help i want to start IE explorer using C# i try many code such as below: ProcessStartInfo startInfo = new ProcessStartInfo("IEXPLORE.EXE"); Process.Start(startInfo); or Process process = new Process(); process.StartInfo.FileName = "C:\\Program Files\\Internet Explorer\\IEXPLORE.EXE";
10
15918
by: Tony | last post by:
I am running an application called AcroComm.exe to poll time clocks here at our company. I have written a small C# app that will poll the clocks based on information found in a DB. My problem is that AcroComm will sometimes stop polling in the middle of the process and terminate. The programing manual for the app says that it sends a code to the operating system when it is done that tells what has happend like the following: 0 ...
5
16458
by: Dean Slindee | last post by:
I have looked everywhere I can think of for the .exe name of the Windows Picture and Fax Viewer. Anybody know what it's named? Thanks, Dean Slindee
9
2334
by: richwood | last post by:
Ok....Super newbie here in C#... I am trying to write an application (myapp.exe) that will start an application called abc.exe and if it is terminated, will restart it. (or rerun myapp.exe) I have tried it in several scripting languages, but they tend to use ntvdm.exe and peg the processor. Sounds easy, I know...but I am not real "sharp" at this. (horrible pun fully intended)
0
2253
by: henning.friese | last post by:
Hello NG, I'm need to write some code which creates tiff files from various document types (doc, pdf, xls). I want to do this by ShellExecuting (via System.Diagnostics.Process) the doc-files with the "print"-verb. This works for me. However, I need to handle the case when a printing application doesnt't quit in a given timespan (for example a password-protected word-document). So I've tried the following:
2
3883
by: =?Utf-8?B?Vmlua2k=?= | last post by:
Hello Everyone, I have an exe application that I want to start remotely.Once I start the application, I want to press ok to that application. To start the application, I did Process.start("C://test/app.exe"). I am writing this code in a C# web application, famework 1.1 How can I press ok to that started application. Any help will be apprecaited
0
8999
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9575
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
9256
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
8260
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
6803
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6080
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4712
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
1
3322
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
2798
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.