Sorry, I accidently posted before finishing my message.
<<<<<<<<

Yes, each thread uses its own instance of the VB6 COM+ Component.
And I use thread.SetApartmentState(Threading.ApartmentState.STA).

In Pseudocode:

MyService:
 OnStart()
   For each ...
      Dim w As New Worker(folderName)
      _workerList.Add(w)
      Dim t As New Threading.Thread(AddressOf w.StartWorker)
      t.SetApartmentState(Threading.ApartmentState.STA)
      t.Start()
   Next

Class Worker
    Private WithEvents _watcher As IO.FileSystemWatcher
    Private _bu As MEDAMBusiness.CMilDispatch 'VB6 COM+ component

    Private Sub _watcher_Created(ByVal sender As Object, ByVal e As
System.IO.FileSystemEventArgs) Handles _watcher.Created
        _bu.Dispatch(e.FullPath)
    End Sub

===================================
This list is hosted by DevelopMentorĀ®  http://www.develop.com

View archives and manage your subscription(s) at http://discuss.develop.com

Reply via email to