Hi,
As I said in e-mail - Your code works OK on my W2k station. This ruled out environmental problems.
Now when I started to modify code for MY service some strange things surfaced.
1. My service did not have any code for NTService_Control event. So I added empty sub and put a call to NTService.LogEvent like this
Code:
Call NTService.LogEvent(svcEventInformation, _
svcMessageInfo, _
NTService.DisplayName & " Control.")
Additionally I put similar calls to write to registry for Start event.
Make/Copy/Restart - not good.
No entries in Eventlog for my service at all. That made me think that Form_Load code was not executed.
2. When I went back to project after restart, line
Code:
Private Sub NTService_Control(ByVal Event As Long)
was in error. Strange I thought. Re-inserted sub definition using dropdown and copied code for sub. Empty sub in error removed.
Make/Copy/Restart - not good. Same with eventlog - no messages, except two stating error in System section.
3. Then I noticed that my service had Initialize event for a form.
So, with little in mind, I added
Code:
Call NTService.LogEvent(svcEventInformation, _
svcMessageInfo, _
NTService.DisplayName & " Control.")
as first code lines for that event.
Make/Copy/Restart - MIRACLE! It works!!!
So I have service starting on bootup. I will have to exercise great care on subsequent modifications in order to retain that behaviour... ;)
Many thanks, Dmitriy for your help, you are such a great person!!!
Regs,
Felix