HomeProjectsServicesContactus
» Guest
  Sign In     Register    
Projects » GenSvc
Developer : Ritey
Date : 2005-03-27 00:00

» Summary :

Application for running normal programs as windows services.

» Catagories :


  • Development Status: Beta
  • Operating System: XP / 2003
  • Licence: Click Here
  • Development Environment: MSVS.NET 2003

» Latest Project Downloads:

Total Download Count For Project : 4921
 
1.0.0.1GenSvc_v1.0.0.1_bin.zip
 2005-12-02Binary14 KbNotes / ChangesMD5:741fe2268fd50176c5b6a1e9843269c63164 HitsDownload
 
1.0.0.1GenSvc_v1.0.0.1_src.zip
 2005-12-02Source Code6 KbNotes / ChangesMD5:f694df1be9b3a04534334fd9599ccef51496 HitsDownload
 

» Project Information :

GenSvc - Generic Windows Service

Development Platform: Win32

IDE: MS VisualStudio.NET Executable Platform: Windows NT/2000/XP/2003

General: This application is used to create a Windows Service for applications that dont wish to get involved in programming the service stuff. You just need to create an executable that you want to be a service. Then install GenSvc.exe as a service. Using a service name that is the name of your executable. eg: myapp.exe will have service name of myapp. (If you want a GUI utitlity for installing services click here) The service Setting should be as follows:- ServiceName(name of service reg key): DisplayName: ImagePath: GenSvc.exe "yourapp.exe" yourparameters

EXAMPLE: ServiceName: notepad DisplayName: My Notepad Service ImagePath: C:/Windows/GenSvc.exe "C:Windows/notepad.exe" c:/Windows/setuplog.txt

This example will set notepad as a service and will open setuplog.exe when run. GenSvc.exe will then wait for your app to exit. If the service is stopped then it Sets a named event (with the name of the service) which your application can wait for. Then your app can exit cleanly without being terminated.

The following code can be used in your app to wait for this named event. (you will need to use CreateThread to syncronously wait for this event so your app can continue executing).

DWORD WINAPI WaitEventThread(LPVOID lpParam)
{
	//get the service name
	char szExe[MAX_PATH];
	char *psname;
	char *p;
	GetModuleFilename(0,szExe,MAX_PATH);
	psname = strrchr(szExe,);
	psname++;
	p = strrchr(psname,.);
	*p=0;
	
	//open the event
	HANDLE hEvent;
	hEvent = OpenEvent(EVENT_ALL_ACCESS,0,psname);
 
	//wait for the event to signal
	WaitForSingleObject(hEvent,INFINITE);
 
	//close event
	CloseEvent(hEvent);
	
	// NOW YOU SHOULD NOTIFY THE REST OF YOU APP TO
	// CLEAN UP AND EXIT WITHIN ONE SECOND //
	// OR YOUR APPLICATION WILL BE TERMINATED //

	return 1;
}
ScreenShot: N/A

Info links: N/A


0 member(s), 15 guest(s)
| Site Map | Statistics | Terms of Use | Privacy Policy |
Copyright (C) GoCoding.Com 2004-2007
Powered by Seditio
Contacts