well am suppose to create a software in which a adminstrator can set a pattern of file name in a conf file.This Software will have a service running in the background that will remove files from the system. The service will read names from a configuration file and remove those files which will have any of these names in the filename.
Can anybody give me an guideline of how to go about it?.....i heard that ATL com wizard can be used for creating windows services....if yes then can you please tell me how to go about it??.......thanks in advance!!
please help urgently......
Pretty much all you need to do is create a new project. Walk through the New project wizard and choose the ATL project template. When the new project wizard opens, choose Service (EXE) server type. After the code gets generated, remove the COM related registration code.
Sorry, I don't have VC6 installed (it's 11 years old btw) so I can't give you more detailed instructions.
ok fine but after the code is generated can you please tell where shall i place my code that is to be executed in background that is deletion of files for the service.....am totally new to this type of programs so kindly avoid my mistakes.......
ok fine but after the code is generated can you please tell where shall i place my code that is to be executed in background that is deletion of files for the service.....am totally new to this type of programs so kindly avoid my mistakes.......
I really can't because VC6 is so old and the newer versions have changed the code generation slightly.
However, if you generate a new ATL service project, then remove the .ncb, debug and release folders, you can zip the project up and post it here. Then I can look at it.
I would abstract the implementation from the boiler plate code and create a class called CAbcService (or whatever is appropriate). I would put all my functional code inside that and create a class member inside the CServiceModule class.
Then just call the appropriate methods.
Code:
inlinevoid CServiceModule::Handler(DWORD dwOpcode)
{
switch (dwOpcode)
{
case SERVICE_CONTROL_STOP:
SetServiceStatus(SERVICE_STOP_PENDING);
PostThreadMessage(dwThreadID, WM_QUIT, 0, 0);
m_AbcService.Stop( );
break;
case SERVICE_CONTROL_PAUSE:
m_AbcService.Pause( );
break;
case SERVICE_CONTROL_CONTINUE:
m_AbcService.Continue( );
break;
case SERVICE_CONTROL_INTERROGATE:
break;
case SERVICE_CONTROL_SHUTDOWN:
m_AbcService.Shutdown( );
break;
default:
LogEvent(_T("Bad service request"));
}
}
In the CServiceModule::Run(), add m_AbcService.Start( ); before the LogEvent( _T("Service Started") ) call.
well i also wish to know that where i shall place my code of the service( i.e. as per my problem deleting all files of the given names in config file) after commenting the above code.........
well i also wish to know that where i shall place my code of the service( i.e. as per my problem deleting all files of the given names in config file) after commenting the above code.........
I was referring to where to put your code when I talked about....
Code:
I would abstract the implementation from the boiler plate code and create a class
To expand a bit. Create a class that contains the functionality you desire and exposes a couple of public methods (such as Start, Stop, Pause, etc). Then just create a member variable of this class inside the CServiceModule class. Then wire up the appropriate public methods in the Run() method and Handler method (as shown above).
can you tell some link so that I could get more information about the topic??any ways thanks for the above help it really helped me....
What I am suggesting is to build a class with public methods and can't really suggest a link other than advice to put up a C++ book if you don't know how to create a class.
ATL Wizard gives more of a point-and-click approach. If you want to see what's happening "under-the-hood", or make a service without the use of ATL check this, or this link from Microsoft.
* The Best Reasons to Target Windows 8
Learn some of the best reasons why you should seriously consider bringing your Android mobile development expertise to bear on the Windows 8 platform.