IonicWind Software

Announcements => User Offerings => Topic started by: Andy on September 11, 2016, 04:58:39 AM

Title: Windows Service in IWB
Post by: Andy on September 11, 2016, 04:58:39 AM
After getting very close, and with Jalih's help, I've managed to create, run, and delete a program built as a windows service.

So here goes....

Step 1.
I created a folder on my C drive called "Services" i.e. C:\Services (if you want to try this then I suggest you create a folder with the same name as above on your C drive - otherwise you will have to amend the paths in the three programs and the .rc file accordingly).

Step 2.
Compile (but do not run yet) createservice.iwb and deleteservice.iwb as single files (not projects).

Step 3.
Open the "myserviceprog" project and build it.

Step 4.
Run createservice.exe as an Administrator to create and run myserviceprog as a service.

Step 5.
Open task manager and click on "Processes" (at least in win 10) under "Background Processes", you should see "IWB Service Program" listed.

Step 6.
Now click on the "Services" tab, scroll down and you should see an entry that says.. "IWBrules" with a Description "IWBDisplayName".

The service should be running.

Step 7.
Right click on it, and select "Stop".

Step 8.
Run deleteservice.exe as an Administrator to delete the service.
If all goes well, the service is no more.

The service program "myserviceprog.exe" produces a log file which you can find in the folder C:\Services\log.txt

Note - myserviceprog.exe is built as a project so that we can add in a display name and icon under "Background Processes" using a resource file (myserviceprog.rc).

If you've followed the steps above correctly, you should be able to create, run, and delete this example service.

I've zipped up the files needed - see attached.

Let me know what you think please....

Andy,
:)


Title: Re: Windows Service in IWB - Enumerating Services
Post by: Andy on September 20, 2016, 06:46:10 AM
Just in case anyone missed this, attached is how to enumerate windows services.

Special thanks to Jalih for helping me out with windows services.

Compile and run as Admin!

Thanks,
Andy.