georgedumaine
Programmer
I have an application that uses functions in an external dll. This dll sends messages back via a callback delegate and I process the messages when they come it. On load of the main form I initialize variables and register call back. Then I call a function in the dll that plays a video file and I wait for a message that playback is completed. At this point I get the next file in a playlist and repeat the process. This all works great since my form is sitting there doing nothing (and using no resources).
The problem I'm having is in making this a windows service with no interface. Where do I wait and "do nothing" while I'm listening for messages to come back from the dll? The service has an OnStart routine that fires a timer and if I register the callback in the OnStart routine I don't see any of the messages. I wasn't successfull putting the registration in the timer either. I do get messages if I put it in a routine called by the timer but that routine has to have an infinite loop so that it isn't garbage collected and that kills my resources. I have put a sleep in the loop but this can't be the right way to deal with my problem.
Any help with this specifically or the structure of VB.NET services in general would be greatly appreciated.
George
The problem I'm having is in making this a windows service with no interface. Where do I wait and "do nothing" while I'm listening for messages to come back from the dll? The service has an OnStart routine that fires a timer and if I register the callback in the OnStart routine I don't see any of the messages. I wasn't successfull putting the registration in the timer either. I do get messages if I put it in a routine called by the timer but that routine has to have an infinite loop so that it isn't garbage collected and that kills my resources. I have put a sleep in the loop but this can't be the right way to deal with my problem.
Any help with this specifically or the structure of VB.NET services in general would be greatly appreciated.
George