O'Reilly logo

Programming Windows® Services with Microsoft® Visual Basic® 2008 by Michael Gernaey

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Updating <Tutorials.ThreadFunc>

We are no longer performing the processing in the class ThreadFunc. However, we will still use it to create the instances of the FileWorker class, set the options, and start the processing. If we don’t, we could cause <OnStart> to take too long to complete and return control to the service control manager (SCM). Again, it is never a good idea to tie up the <OnStart> method. Example 4-21 shows the modifications required to our <ThreadFunc> method to support the new multi-file processing capabilities.

Example 4-21. Updated Tutorials.ThreadFunc.

Private Sub ThreadFunc() Try Dim tmpOptions(5) As FileWorkerOptions Dim iLoop As Short Dim tmpWorker As FileWorker For iLoop = 0 To 4 tmpOptions(iLoop) = New FileWorkerOptions ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required