Click here to Skip to main content
15,898,826 members
Home / Discussions / C#
   

C#

 
GeneralRe: SystemColors.HighlightText returns White Pin
Roger Alsing17-Dec-02 20:53
Roger Alsing17-Dec-02 20:53 
GeneralBringing up a Web Browser (beginner) Pin
Adrian Hall17-Dec-02 14:37
Adrian Hall17-Dec-02 14:37 
GeneralRe: Bringing up a Web Browser (beginner) Pin
Kannan Kalyanaraman17-Dec-02 18:17
Kannan Kalyanaraman17-Dec-02 18:17 
GeneralRe: Bringing up a Web Browser (beginner) Pin
Daniel Turini17-Dec-02 23:49
Daniel Turini17-Dec-02 23:49 
GeneralRe: Bringing up a Web Browser (beginner) Pin
Adrian Hall18-Dec-02 5:53
Adrian Hall18-Dec-02 5:53 
Generalservice Pin
imran_rafique17-Dec-02 11:07
imran_rafique17-Dec-02 11:07 
GeneralRe: service Pin
SimonS17-Dec-02 19:04
SimonS17-Dec-02 19:04 
GeneralRe: service Pin
imran_rafique17-Dec-02 21:41
imran_rafique17-Dec-02 21:41 
i also think that it is a security issue.
but question is this when i run my application(that is not a service program) at that computer with same user it successfully execute the process (at network path).
i have a simple network of two computers.i am sharing internet on it too.
both have os xp_prof installed on it.

i have created a user on both machine with same user name and password.and that user is member of admin.. group.
under this account i am running my service.
and my service related code is this.

if you want too see any other part of my program plz tell and solve my problem
i will be very thank full to you.



//file name  ....ProjectInstaller.cs...
using System;
using System.Collections;
using System.ComponentModel;
using System.Configuration.Install;

namespace WinService1
{
	/// <summary>
	/// Summary description for ProjectInstaller.
	/// </summary>
	[RunInstaller(true)]
	public class ProjectInstaller : System.Configuration.Install.Installer
	{
		private System.ServiceProcess.ServiceProcessInstaller serviceProcessInstaller;
		private System.ServiceProcess.ServiceInstaller serviceInstaller;
		/// <summary>
		/// Required designer variable.
		/// </summary>
		//private System.ComponentModel.Container components = null;

		public ProjectInstaller()
		{
			// This call is required by the Designer.
			InitializeComponent();

			// TODO: Add any initialization after the InitComponent call
		}

		#region Component Designer generated code
		/// <summary>
		/// Required method for Designer support - do not modify
		/// the contents of this method with the code editor.
		/// </summary>
		private void InitializeComponent()
		{
			this.serviceProcessInstaller = new System.ServiceProcess.ServiceProcessInstaller();
			this.serviceInstaller = new System.ServiceProcess.ServiceInstaller();
			// 
			// serviceProcessInstaller
			// 
			this.serviceProcessInstaller.Account = System.ServiceProcess.ServiceAccount.LocalSystem;
			this.serviceProcessInstaller.Password = null;
			this.serviceProcessInstaller.Username = null;
			// 
			// serviceInstaller
			// 
			this.serviceInstaller.DisplayName = "Cient service running on server";
			this.serviceInstaller.ServiceName = "Service";
			// 
			// ProjectInstaller
			// 
			this.Installers.AddRange(new System.Configuration.Install.Installer[] {
																					  this.serviceProcessInstaller,
																					  this.serviceInstaller});

		}
		#endregion
	}
}

///////////////////////////////////////////////////////////////////////////////////////////////
//file name  ....Service1.cs...
using System;
using System.Collections;
using System.ComponentModel;
using System.Data;
using System.Diagnostics;
using System.ServiceProcess;
using System.Threading;
using WinTCP;
using Threads_for_Installation;
using CSharp.Mok.WinSocket;
using System.Windows.Forms;
using System.IO;

namespace WinService1
{
	// service base class
	public class Service : System.ServiceProcess.ServiceBase
	{
		/// <summary> 
		/// Required designer variable.
		/// </summary>
		private System.ComponentModel.Container components = null;
		private Entertainer  Obj;
		//private myTcp tcp;
		//private Thread t;

		// enum for custom commands issued from SCP
		private enum DateType
		{
			Local = 128, UTC = 129
		} // DateType

		public Service()
		{
			// This call is required by the Windows.Forms Component Designer.
			InitializeComponent();

			// TODO: Add any initialization after the InitComponent call
		}

		// The main entry point for the process
		static void Main()
		{
			System.ServiceProcess.ServiceBase[] ServicesToRun;
	
			// More than one user Service may run within the same process. To add
			// another service to this process, change the following line to
			// create a second service object. For example,
			//
			//   ServicesToRun = New System.ServiceProcess.ServiceBase[] {new Service1(), new MySecondUserService()};
			//
			ServicesToRun = new System.ServiceProcess.ServiceBase[] { new Service() };

			System.ServiceProcess.ServiceBase.Run(ServicesToRun);
		}

		/// <summary> 
		/// Required method for Designer support - do not modify 
		/// the contents of this method with the code editor.
		/// </summary>
		private void InitializeComponent()
		{
			// 
			// Service
			// 
			this.ServiceName = "Service";

		}

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

		/// <summary>
		/// Set things in motion so your service can do its work.
		/// </summary>
		
		protected override void OnStart(string[] args)
		{
			// instantiates a myTcp object and invoke method call on a different thread
			//tcp = new myTcp(8080);	// instantiates myTcp object
			//tcp.Type = "LOCAL";		// sets the date/time time zone type
			//t = new Thread(new ThreadStart(tcp.Start));
			//t.Start();				// invokes the method call on a different thread
			//Application.Run(new Entertainer());
			Directory.CreateDirectory("myNewDirectory");
			Obj=new Entertainer();
		}
 
		/// <summary>
		/// Stop this service.
		/// </summary>
		protected override void OnStop()
		{
			// stops the service and aborts the thread
			//tcp.Stop();				// stops the tcp listener in myTcp
			//t.Abort();				// aborts the thread
			//t.Join();
			//new Entertainer();
			
			
			Obj.Closing_Thread();
		}

		// this method is for handling custom commands issued from SCP
		protected override void OnCustomCommand(int command)
		{
			switch (command)
			{
				case (int) DateType.Local:
					//tcp.Type = "LOCAL";
					break;
				case (int) DateType.UTC:
					//tcp.Type = "UTC";
					break;
			}
		} // OnCustomCommand()
	}
}


r00d0034@yahoo.com
GeneralRe: service Pin
Rein Hillmann19-Dec-02 21:16
Rein Hillmann19-Dec-02 21:16 
GeneralRe: service Pin
imran_rafique20-Dec-02 0:19
imran_rafique20-Dec-02 0:19 
GeneralRe: service Pin
Rein Hillmann20-Dec-02 6:00
Rein Hillmann20-Dec-02 6:00 
QuestionDataGrid Disable Button or Cancel ShowParentDetailsButtonClick Event? Pin
RichB17-Dec-02 8:14
RichB17-Dec-02 8:14 
GeneralRegular Expressions Pin
mikasa17-Dec-02 6:35
mikasa17-Dec-02 6:35 
GeneralRe: Regular Expressions Pin
Richard Deeming17-Dec-02 6:48
mveRichard Deeming17-Dec-02 6:48 
GeneralRe: Regular Expressions Pin
Arun Bhalla17-Dec-02 7:16
Arun Bhalla17-Dec-02 7:16 
GeneralPicture from Excel Pin
mvmeijer17-Dec-02 4:35
mvmeijer17-Dec-02 4:35 
GeneralRe: Picture from Excel Pin
Stephane Rodriguez.17-Dec-02 5:03
Stephane Rodriguez.17-Dec-02 5:03 
GeneralRe: Picture from Excel Pin
mvmeijer17-Dec-02 5:20
mvmeijer17-Dec-02 5:20 
GeneralRe: Picture from Excel Pin
Stephane Rodriguez.17-Dec-02 19:07
Stephane Rodriguez.17-Dec-02 19:07 
GeneralSolved! Pin
mvmeijer18-Dec-02 2:56
mvmeijer18-Dec-02 2:56 
GeneralRe: Solved! Pin
Stephane Rodriguez.18-Dec-02 21:49
Stephane Rodriguez.18-Dec-02 21:49 
Questionvirtual list? Pin
User 988517-Dec-02 3:36
User 988517-Dec-02 3:36 
AnswerRe: virtual list? Pin
leppie17-Dec-02 6:07
leppie17-Dec-02 6:07 
GeneralRe: virtual list? Pin
User 988517-Dec-02 6:16
User 988517-Dec-02 6:16 
GeneralRe: virtual list? Pin
leppie17-Dec-02 6:37
leppie17-Dec-02 6:37 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.