Why Does This Fail ( Threading )

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • One Handed Man \( OHM - Terry Burns \)

    Why Does This Fail ( Threading )

    Assumes a Form with a Panel on it., Does the Mutex have to be within the
    address of a thread start address ?

    Cheers - OHM

    '----------- *************** ----------------

    Private endProgram As Boolean = False

    Dim image1 As Image = Image.FromFile( "..\Images\gun. bmp")

    Dim image2 As Image = Image.FromFile( "..\Images\Inva der.bmp")

    Dim space As Graphics

    Private Sub Button1_Click(B yVal sender As System.Object, ByVal e As
    System.EventArg s) Handles Button1.Click



    Dim Thread1 As New Threading.Threa d(AddressOf Me.WriteImage1)

    Dim Thread2 As New Threading.Threa d(AddressOf Me.WriteImage2)

    space = Panel1.CreateGr aphics()

    Thread1.Start()

    Thread2.Start()

    End Sub



    Private Sub WriteImage1()

    While Not endProgram

    DrawImage(space , image1, New Point(10, 10))

    End While

    End Sub

    Private Sub WriteImage2()

    While Not endProgram

    DrawImage(space , image2, New Point(50, 50))

    End While

    End Sub

    Public Sub DrawImage(ByVal g As Graphics, ByVal i As Image, ByVal p As
    Point)

    Dim m As New Threading.Mutex

    m.WaitOne()

    g.DrawImage(i, p)

    m.ReleaseMutex( )

    End Sub


    --
    OHM ( Terry Burns ) * Use the following to email me *

    Dim ch() As Char = "ufssz/cvsotAhsfbuTpmv ujpotXjui/OFU".ToCharArra y()
    For i As Int32 = 0 To ch.Length - 1
    ch(i) = Convert.ToChar( Convert.ToInt16 (ch(i)) - 1)
    Next
    Process.Start(" mailto:" & New String(ch))
    --



  • Larry Serflaten

    #2
    Re: Why Does This Fail ( Threading )


    "One Handed Man ( OHM - Terry Burns )" <news.microsoft .com> wrote[color=blue]
    > Assumes a Form with a Panel on it., Does the Mutex have to be within the
    > address of a thread start address ?[/color]

    I would think it would have to be declared at a larger scope than the
    procedure you need it in. I looks to me like you create and destroy a new
    mutex for each call....

    LFS
    [color=blue]
    > Public Sub DrawImage(ByVal g As Graphics, ByVal i As Image, ByVal p As
    > Point)
    >
    > Dim m As New Threading.Mutex
    >
    > m.WaitOne()
    >
    > g.DrawImage(i, p)
    >
    > m.ReleaseMutex( )
    >
    > End Sub[/color]



    Comment

    • Ken Tucker [MVP]

      #3
      Re: Why Does This Fail ( Threading )

      Hi,

      First cant update the ui from a thread.
      Find official documentation, practical know-how, and expert guidance for builders working and troubleshooting in Microsoft products.


      Second. You might be better of with synclock instead a mutex

      Public Sub DrawImage(ByVal g As Graphics, ByVal i As Image, ByVal p As
      Point)


      synclock g

      g.DrawImage(i, p)

      end synclock
      End Sub


      Ken
      -----------------
      "One Handed Man ( OHM - Terry Burns )" <news.microsoft .com> wrote in message
      news:e5cAkk4tEH A.2692@TK2MSFTN GP10.phx.gbl...
      Assumes a Form with a Panel on it., Does the Mutex have to be within the
      address of a thread start address ?

      Cheers - OHM

      '----------- *************** ----------------

      Private endProgram As Boolean = False

      Dim image1 As Image = Image.FromFile( "..\Images\gun. bmp")

      Dim image2 As Image = Image.FromFile( "..\Images\Inva der.bmp")

      Dim space As Graphics

      Private Sub Button1_Click(B yVal sender As System.Object, ByVal e As
      System.EventArg s) Handles Button1.Click



      Dim Thread1 As New Threading.Threa d(AddressOf Me.WriteImage1)

      Dim Thread2 As New Threading.Threa d(AddressOf Me.WriteImage2)

      space = Panel1.CreateGr aphics()

      Thread1.Start()

      Thread2.Start()

      End Sub



      Private Sub WriteImage1()

      While Not endProgram

      DrawImage(space , image1, New Point(10, 10))

      End While

      End Sub

      Private Sub WriteImage2()

      While Not endProgram

      DrawImage(space , image2, New Point(50, 50))

      End While

      End Sub

      Public Sub DrawImage(ByVal g As Graphics, ByVal i As Image, ByVal p As
      Point)

      Dim m As New Threading.Mutex

      m.WaitOne()

      g.DrawImage(i, p)

      m.ReleaseMutex( )

      End Sub


      --
      OHM ( Terry Burns ) * Use the following to email me *

      Dim ch() As Char = "ufssz/cvsotAhsfbuTpmv ujpotXjui/OFU".ToCharArra y()
      For i As Int32 = 0 To ch.Length - 1
      ch(i) = Convert.ToChar( Convert.ToInt16 (ch(i)) - 1)
      Next
      Process.Start(" mailto:" & New String(ch))
      --




      Comment

      • CJ Taylor

        #4
        Re: Why Does This Fail ( Threading )

        Don't declare the mutex at the procedure level, perhaps try to at the
        module/class level. Otherwise, each time you enter the procedure you create
        a new (and unnamed) mutex variable which the other thread doesn't care
        about. So of course it tries to write.

        Alright, so after doing some more reading, was looking at the waithandle and
        how that works. Look into AutoResetEvent, in which case its defined as the
        threads communicating through events... I can help more in a minute, but
        have to finish something else now and wanted to get this out to you. It
        inherits from WaitHandle (same as Mutex waitone). but has a few more
        options that do the dirty work under the sheets...

        Check it out and let me know if it helps..
        -CJ

        I'll write more shortly.


        "One Handed Man ( OHM - Terry Burns )" <news.microsoft .com> wrote in message
        news:e5cAkk4tEH A.2692@TK2MSFTN GP10.phx.gbl...[color=blue]
        > Assumes a Form with a Panel on it., Does the Mutex have to be within the
        > address of a thread start address ?
        >
        > Cheers - OHM
        >
        > '----------- *************** ----------------
        >
        > Private endProgram As Boolean = False
        >
        > Dim image1 As Image = Image.FromFile( "..\Images\gun. bmp")
        >
        > Dim image2 As Image = Image.FromFile( "..\Images\Inva der.bmp")
        >
        > Dim space As Graphics
        >
        > Private Sub Button1_Click(B yVal sender As System.Object, ByVal e As
        > System.EventArg s) Handles Button1.Click
        >
        >
        >
        > Dim Thread1 As New Threading.Threa d(AddressOf Me.WriteImage1)
        >
        > Dim Thread2 As New Threading.Threa d(AddressOf Me.WriteImage2)
        >
        > space = Panel1.CreateGr aphics()
        >
        > Thread1.Start()
        >
        > Thread2.Start()
        >
        > End Sub
        >
        >
        >
        > Private Sub WriteImage1()
        >
        > While Not endProgram
        >
        > DrawImage(space , image1, New Point(10, 10))
        >
        > End While
        >
        > End Sub
        >
        > Private Sub WriteImage2()
        >
        > While Not endProgram
        >
        > DrawImage(space , image2, New Point(50, 50))
        >
        > End While
        >
        > End Sub
        >
        > Public Sub DrawImage(ByVal g As Graphics, ByVal i As Image, ByVal p As
        > Point)
        >
        > Dim m As New Threading.Mutex
        >
        > m.WaitOne()
        >
        > g.DrawImage(i, p)
        >
        > m.ReleaseMutex( )
        >
        > End Sub
        >
        >
        > --
        > OHM ( Terry Burns ) * Use the following to email me *
        >
        > Dim ch() As Char = "ufssz/cvsotAhsfbuTpmv ujpotXjui/OFU".ToCharArra y()
        > For i As Int32 = 0 To ch.Length - 1
        > ch(i) = Convert.ToChar( Convert.ToInt16 (ch(i)) - 1)
        > Next
        > Process.Start(" mailto:" & New String(ch))
        > --
        >
        >
        >[/color]


        Comment

        • One Handed Man \( OHM - Terry Burns \)

          #5
          Re: Why Does This Fail ( Threading )

          Tried decaling the Mutex in a module,that didnt work either

          --
          OHM ( Terry Burns ) * Use the following to email me *

          Dim ch() As Char = "ufssz/cvsotAhsfbuTpmv ujpotXjui/OFU".ToCharArra y()
          For i As Int32 = 0 To ch.Length - 1
          ch(i) = Convert.ToChar( Convert.ToInt16 (ch(i)) - 1)
          Next
          Process.Start(" mailto:" & New String(ch))
          --


          "Larry Serflaten" <serflaten@usin ternet.com> wrote in message
          news:eCes4Z5tEH A.2800@tk2msftn gp13.phx.gbl...[color=blue]
          >
          > "One Handed Man ( OHM - Terry Burns )" <news.microsoft .com> wrote[color=green]
          >> Assumes a Form with a Panel on it., Does the Mutex have to be within the
          >> address of a thread start address ?[/color]
          >
          > I would think it would have to be declared at a larger scope than the
          > procedure you need it in. I looks to me like you create and destroy a new
          > mutex for each call....
          >
          > LFS
          >[color=green]
          >> Public Sub DrawImage(ByVal g As Graphics, ByVal i As Image, ByVal p As
          >> Point)
          >>
          >> Dim m As New Threading.Mutex
          >>
          >> m.WaitOne()
          >>
          >> g.DrawImage(i, p)
          >>
          >> m.ReleaseMutex( )
          >>
          >> End Sub[/color]
          >
          >
          >[/color]


          Comment

          • One Handed Man \( OHM - Terry Burns \)

            #6
            Re: Why Does This Fail ( Threading )

            tried Synclock, that doesent seem to work

            --
            OHM ( Terry Burns ) * Use the following to email me *

            Dim ch() As Char = "ufssz/cvsotAhsfbuTpmv ujpotXjui/OFU".ToCharArra y()
            For i As Int32 = 0 To ch.Length - 1
            ch(i) = Convert.ToChar( Convert.ToInt16 (ch(i)) - 1)
            Next
            Process.Start(" mailto:" & New String(ch))
            --


            "Ken Tucker [MVP]" <vb2ae@bellsout h.net> wrote in message
            news:%23UaF$u5t EHA.3152@TK2MSF TNGP14.phx.gbl. ..[color=blue]
            > Hi,
            >
            > First cant update the ui from a thread.
            > http://msdn.microsoft.com/msdnmag/is...asicInstincts/
            >
            > Second. You might be better of with synclock instead a mutex
            >
            > Public Sub DrawImage(ByVal g As Graphics, ByVal i As Image, ByVal p As
            > Point)
            >
            >
            > synclock g
            >
            > g.DrawImage(i, p)
            >
            > end synclock
            > End Sub
            >
            >
            > Ken
            > -----------------
            > "One Handed Man ( OHM - Terry Burns )" <news.microsoft .com> wrote in
            > message
            > news:e5cAkk4tEH A.2692@TK2MSFTN GP10.phx.gbl...
            > Assumes a Form with a Panel on it., Does the Mutex have to be within the
            > address of a thread start address ?
            >
            > Cheers - OHM
            >
            > '----------- *************** ----------------
            >
            > Private endProgram As Boolean = False
            >
            > Dim image1 As Image = Image.FromFile( "..\Images\gun. bmp")
            >
            > Dim image2 As Image = Image.FromFile( "..\Images\Inva der.bmp")
            >
            > Dim space As Graphics
            >
            > Private Sub Button1_Click(B yVal sender As System.Object, ByVal e As
            > System.EventArg s) Handles Button1.Click
            >
            >
            >
            > Dim Thread1 As New Threading.Threa d(AddressOf Me.WriteImage1)
            >
            > Dim Thread2 As New Threading.Threa d(AddressOf Me.WriteImage2)
            >
            > space = Panel1.CreateGr aphics()
            >
            > Thread1.Start()
            >
            > Thread2.Start()
            >
            > End Sub
            >
            >
            >
            > Private Sub WriteImage1()
            >
            > While Not endProgram
            >
            > DrawImage(space , image1, New Point(10, 10))
            >
            > End While
            >
            > End Sub
            >
            > Private Sub WriteImage2()
            >
            > While Not endProgram
            >
            > DrawImage(space , image2, New Point(50, 50))
            >
            > End While
            >
            > End Sub
            >
            > Public Sub DrawImage(ByVal g As Graphics, ByVal i As Image, ByVal p As
            > Point)
            >
            > Dim m As New Threading.Mutex
            >
            > m.WaitOne()
            >
            > g.DrawImage(i, p)
            >
            > m.ReleaseMutex( )
            >
            > End Sub
            >
            >
            > --
            > OHM ( Terry Burns ) * Use the following to email me *
            >
            > Dim ch() As Char = "ufssz/cvsotAhsfbuTpmv ujpotXjui/OFU".ToCharArra y()
            > For i As Int32 = 0 To ch.Length - 1
            > ch(i) = Convert.ToChar( Convert.ToInt16 (ch(i)) - 1)
            > Next
            > Process.Start(" mailto:" & New String(ch))
            > --
            >
            >
            >
            >[/color]


            Comment

            • One Handed Man \( OHM - Terry Burns \)

              #7
              Re: Why Does This Fail ( Threading )

              tried declaring at module level, that didnt work. Tried Synclock, that didnt
              work either

              --
              OHM ( Terry Burns ) * Use the following to email me *

              Dim ch() As Char = "ufssz/cvsotAhsfbuTpmv ujpotXjui/OFU".ToCharArra y()
              For i As Int32 = 0 To ch.Length - 1
              ch(i) = Convert.ToChar( Convert.ToInt16 (ch(i)) - 1)
              Next
              Process.Start(" mailto:" & New String(ch))
              --


              "CJ Taylor" <[cege] at [tavayn] dit commmmm> wrote in message
              news:eKeG7$5tEH A.2468@TK2MSFTN GP09.phx.gbl...[color=blue]
              > Don't declare the mutex at the procedure level, perhaps try to at the
              > module/class level. Otherwise, each time you enter the procedure you
              > create
              > a new (and unnamed) mutex variable which the other thread doesn't care
              > about. So of course it tries to write.
              >
              > Alright, so after doing some more reading, was looking at the waithandle
              > and
              > how that works. Look into AutoResetEvent, in which case its defined as
              > the
              > threads communicating through events... I can help more in a minute, but
              > have to finish something else now and wanted to get this out to you. It
              > inherits from WaitHandle (same as Mutex waitone). but has a few more
              > options that do the dirty work under the sheets...
              >
              > Check it out and let me know if it helps..
              > -CJ
              >
              > I'll write more shortly.
              >
              >
              > "One Handed Man ( OHM - Terry Burns )" <news.microsoft .com> wrote in
              > message
              > news:e5cAkk4tEH A.2692@TK2MSFTN GP10.phx.gbl...[color=green]
              >> Assumes a Form with a Panel on it., Does the Mutex have to be within the
              >> address of a thread start address ?
              >>
              >> Cheers - OHM
              >>
              >> '----------- *************** ----------------
              >>
              >> Private endProgram As Boolean = False
              >>
              >> Dim image1 As Image = Image.FromFile( "..\Images\gun. bmp")
              >>
              >> Dim image2 As Image = Image.FromFile( "..\Images\Inva der.bmp")
              >>
              >> Dim space As Graphics
              >>
              >> Private Sub Button1_Click(B yVal sender As System.Object, ByVal e As
              >> System.EventArg s) Handles Button1.Click
              >>
              >>
              >>
              >> Dim Thread1 As New Threading.Threa d(AddressOf Me.WriteImage1)
              >>
              >> Dim Thread2 As New Threading.Threa d(AddressOf Me.WriteImage2)
              >>
              >> space = Panel1.CreateGr aphics()
              >>
              >> Thread1.Start()
              >>
              >> Thread2.Start()
              >>
              >> End Sub
              >>
              >>
              >>
              >> Private Sub WriteImage1()
              >>
              >> While Not endProgram
              >>
              >> DrawImage(space , image1, New Point(10, 10))
              >>
              >> End While
              >>
              >> End Sub
              >>
              >> Private Sub WriteImage2()
              >>
              >> While Not endProgram
              >>
              >> DrawImage(space , image2, New Point(50, 50))
              >>
              >> End While
              >>
              >> End Sub
              >>
              >> Public Sub DrawImage(ByVal g As Graphics, ByVal i As Image, ByVal p As
              >> Point)
              >>
              >> Dim m As New Threading.Mutex
              >>
              >> m.WaitOne()
              >>
              >> g.DrawImage(i, p)
              >>
              >> m.ReleaseMutex( )
              >>
              >> End Sub
              >>
              >>
              >> --
              >> OHM ( Terry Burns ) * Use the following to email me *
              >>
              >> Dim ch() As Char = "ufssz/cvsotAhsfbuTpmv ujpotXjui/OFU".ToCharArra y()
              >> For i As Int32 = 0 To ch.Length - 1
              >> ch(i) = Convert.ToChar( Convert.ToInt16 (ch(i)) - 1)
              >> Next
              >> Process.Start(" mailto:" & New String(ch))
              >> --
              >>
              >>
              >>[/color]
              >
              >[/color]


              Comment

              • CJ Taylor

                #8
                Re: Why Does This Fail ( Threading )

                Try AutoResetEvent


                "One Handed Man ( OHM - Terry Burns )" <news.microsoft .com> wrote in message
                news:eoCW9D7tEH A.2536@TK2MSFTN GP11.phx.gbl...[color=blue]
                > tried declaring at module level, that didnt work. Tried Synclock, that
                > didnt work either
                >
                > --
                > OHM ( Terry Burns ) * Use the following to email me *
                >
                > Dim ch() As Char = "ufssz/cvsotAhsfbuTpmv ujpotXjui/OFU".ToCharArra y()
                > For i As Int32 = 0 To ch.Length - 1
                > ch(i) = Convert.ToChar( Convert.ToInt16 (ch(i)) - 1)
                > Next
                > Process.Start(" mailto:" & New String(ch))
                > --
                >
                >
                > "CJ Taylor" <[cege] at [tavayn] dit commmmm> wrote in message
                > news:eKeG7$5tEH A.2468@TK2MSFTN GP09.phx.gbl...[color=green]
                >> Don't declare the mutex at the procedure level, perhaps try to at the
                >> module/class level. Otherwise, each time you enter the procedure you
                >> create
                >> a new (and unnamed) mutex variable which the other thread doesn't care
                >> about. So of course it tries to write.
                >>
                >> Alright, so after doing some more reading, was looking at the waithandle
                >> and
                >> how that works. Look into AutoResetEvent, in which case its defined as
                >> the
                >> threads communicating through events... I can help more in a minute, but
                >> have to finish something else now and wanted to get this out to you. It
                >> inherits from WaitHandle (same as Mutex waitone). but has a few more
                >> options that do the dirty work under the sheets...
                >>
                >> Check it out and let me know if it helps..
                >> -CJ
                >>
                >> I'll write more shortly.
                >>
                >>
                >> "One Handed Man ( OHM - Terry Burns )" <news.microsoft .com> wrote in
                >> message
                >> news:e5cAkk4tEH A.2692@TK2MSFTN GP10.phx.gbl...[color=darkred]
                >>> Assumes a Form with a Panel on it., Does the Mutex have to be within the
                >>> address of a thread start address ?
                >>>
                >>> Cheers - OHM
                >>>
                >>> '----------- *************** ----------------
                >>>
                >>> Private endProgram As Boolean = False
                >>>
                >>> Dim image1 As Image = Image.FromFile( "..\Images\gun. bmp")
                >>>
                >>> Dim image2 As Image = Image.FromFile( "..\Images\Inva der.bmp")
                >>>
                >>> Dim space As Graphics
                >>>
                >>> Private Sub Button1_Click(B yVal sender As System.Object, ByVal e As
                >>> System.EventArg s) Handles Button1.Click
                >>>
                >>>
                >>>
                >>> Dim Thread1 As New Threading.Threa d(AddressOf Me.WriteImage1)
                >>>
                >>> Dim Thread2 As New Threading.Threa d(AddressOf Me.WriteImage2)
                >>>
                >>> space = Panel1.CreateGr aphics()
                >>>
                >>> Thread1.Start()
                >>>
                >>> Thread2.Start()
                >>>
                >>> End Sub
                >>>
                >>>
                >>>
                >>> Private Sub WriteImage1()
                >>>
                >>> While Not endProgram
                >>>
                >>> DrawImage(space , image1, New Point(10, 10))
                >>>
                >>> End While
                >>>
                >>> End Sub
                >>>
                >>> Private Sub WriteImage2()
                >>>
                >>> While Not endProgram
                >>>
                >>> DrawImage(space , image2, New Point(50, 50))
                >>>
                >>> End While
                >>>
                >>> End Sub
                >>>
                >>> Public Sub DrawImage(ByVal g As Graphics, ByVal i As Image, ByVal p As
                >>> Point)
                >>>
                >>> Dim m As New Threading.Mutex
                >>>
                >>> m.WaitOne()
                >>>
                >>> g.DrawImage(i, p)
                >>>
                >>> m.ReleaseMutex( )
                >>>
                >>> End Sub
                >>>
                >>>
                >>> --
                >>> OHM ( Terry Burns ) * Use the following to email me *
                >>>
                >>> Dim ch() As Char = "ufssz/cvsotAhsfbuTpmv ujpotXjui/OFU".ToCharArra y()
                >>> For i As Int32 = 0 To ch.Length - 1
                >>> ch(i) = Convert.ToChar( Convert.ToInt16 (ch(i)) - 1)
                >>> Next
                >>> Process.Start(" mailto:" & New String(ch))
                >>> --
                >>>
                >>>
                >>>[/color]
                >>
                >>[/color]
                >
                >[/color]


                Comment

                • One Handed Man \( OHM - Terry Burns \)

                  #9
                  Re: Why Does This Fail ( Threading )

                  Same problem

                  --
                  OHM ( Terry Burns ) * Use the following to email me *

                  Dim ch() As Char = "ufssz/cvsotAhsfbuTpmv ujpotXjui/OFU".ToCharArra y()
                  For i As Int32 = 0 To ch.Length - 1
                  ch(i) = Convert.ToChar( Convert.ToInt16 (ch(i)) - 1)
                  Next
                  Process.Start(" mailto:" & New String(ch))
                  --


                  "CJ Taylor" <cege [ahh ttt] tavayn wooohooo hooo ohhh com> wrote in message
                  news:uLdXox8tEH A.3572@tk2msftn gp13.phx.gbl...[color=blue]
                  > Try AutoResetEvent
                  >
                  >
                  > "One Handed Man ( OHM - Terry Burns )" <news.microsoft .com> wrote in
                  > message news:eoCW9D7tEH A.2536@TK2MSFTN GP11.phx.gbl...[color=green]
                  >> tried declaring at module level, that didnt work. Tried Synclock, that
                  >> didnt work either
                  >>
                  >> --
                  >> OHM ( Terry Burns ) * Use the following to email me *
                  >>
                  >> Dim ch() As Char = "ufssz/cvsotAhsfbuTpmv ujpotXjui/OFU".ToCharArra y()
                  >> For i As Int32 = 0 To ch.Length - 1
                  >> ch(i) = Convert.ToChar( Convert.ToInt16 (ch(i)) - 1)
                  >> Next
                  >> Process.Start(" mailto:" & New String(ch))
                  >> --
                  >>
                  >>
                  >> "CJ Taylor" <[cege] at [tavayn] dit commmmm> wrote in message
                  >> news:eKeG7$5tEH A.2468@TK2MSFTN GP09.phx.gbl...[color=darkred]
                  >>> Don't declare the mutex at the procedure level, perhaps try to at the
                  >>> module/class level. Otherwise, each time you enter the procedure you
                  >>> create
                  >>> a new (and unnamed) mutex variable which the other thread doesn't care
                  >>> about. So of course it tries to write.
                  >>>
                  >>> Alright, so after doing some more reading, was looking at the waithandle
                  >>> and
                  >>> how that works. Look into AutoResetEvent, in which case its defined as
                  >>> the
                  >>> threads communicating through events... I can help more in a minute,
                  >>> but
                  >>> have to finish something else now and wanted to get this out to you. It
                  >>> inherits from WaitHandle (same as Mutex waitone). but has a few more
                  >>> options that do the dirty work under the sheets...
                  >>>
                  >>> Check it out and let me know if it helps..
                  >>> -CJ
                  >>>
                  >>> I'll write more shortly.
                  >>>
                  >>>
                  >>> "One Handed Man ( OHM - Terry Burns )" <news.microsoft .com> wrote in
                  >>> message
                  >>> news:e5cAkk4tEH A.2692@TK2MSFTN GP10.phx.gbl...
                  >>>> Assumes a Form with a Panel on it., Does the Mutex have to be within
                  >>>> the
                  >>>> address of a thread start address ?
                  >>>>
                  >>>> Cheers - OHM
                  >>>>
                  >>>> '----------- *************** ----------------
                  >>>>
                  >>>> Private endProgram As Boolean = False
                  >>>>
                  >>>> Dim image1 As Image = Image.FromFile( "..\Images\gun. bmp")
                  >>>>
                  >>>> Dim image2 As Image = Image.FromFile( "..\Images\Inva der.bmp")
                  >>>>
                  >>>> Dim space As Graphics
                  >>>>
                  >>>> Private Sub Button1_Click(B yVal sender As System.Object, ByVal e As
                  >>>> System.EventArg s) Handles Button1.Click
                  >>>>
                  >>>>
                  >>>>
                  >>>> Dim Thread1 As New Threading.Threa d(AddressOf Me.WriteImage1)
                  >>>>
                  >>>> Dim Thread2 As New Threading.Threa d(AddressOf Me.WriteImage2)
                  >>>>
                  >>>> space = Panel1.CreateGr aphics()
                  >>>>
                  >>>> Thread1.Start()
                  >>>>
                  >>>> Thread2.Start()
                  >>>>
                  >>>> End Sub
                  >>>>
                  >>>>
                  >>>>
                  >>>> Private Sub WriteImage1()
                  >>>>
                  >>>> While Not endProgram
                  >>>>
                  >>>> DrawImage(space , image1, New Point(10, 10))
                  >>>>
                  >>>> End While
                  >>>>
                  >>>> End Sub
                  >>>>
                  >>>> Private Sub WriteImage2()
                  >>>>
                  >>>> While Not endProgram
                  >>>>
                  >>>> DrawImage(space , image2, New Point(50, 50))
                  >>>>
                  >>>> End While
                  >>>>
                  >>>> End Sub
                  >>>>
                  >>>> Public Sub DrawImage(ByVal g As Graphics, ByVal i As Image, ByVal p As
                  >>>> Point)
                  >>>>
                  >>>> Dim m As New Threading.Mutex
                  >>>>
                  >>>> m.WaitOne()
                  >>>>
                  >>>> g.DrawImage(i, p)
                  >>>>
                  >>>> m.ReleaseMutex( )
                  >>>>
                  >>>> End Sub
                  >>>>
                  >>>>
                  >>>> --
                  >>>> OHM ( Terry Burns ) * Use the following to email me *
                  >>>>
                  >>>> Dim ch() As Char = "ufssz/cvsotAhsfbuTpmv ujpotXjui/OFU".ToCharArra y()
                  >>>> For i As Int32 = 0 To ch.Length - 1
                  >>>> ch(i) = Convert.ToChar( Convert.ToInt16 (ch(i)) - 1)
                  >>>> Next
                  >>>> Process.Start(" mailto:" & New String(ch))
                  >>>> --
                  >>>>
                  >>>>
                  >>>>
                  >>>
                  >>>[/color]
                  >>
                  >>[/color]
                  >
                  >[/color]


                  Comment

                  • Larry Serflaten

                    #10
                    Re: Why Does This Fail ( Threading )


                    "One Handed Man ( OHM - Terry Burns )" <news.microsoft .com> wrote[color=blue]
                    > Tried decaling the Mutex in a module,that didnt work either[/color]

                    I suggested using a delegate. Try this out in a new form with one button.
                    Paste in the code after the designer code.

                    Also as I was building this up, it occured to me that some sort of pooling
                    should be used, should it not? Invaders come and go over the course of the
                    game, so pooling may let the system managed them a little better....

                    HTH
                    LFS

                    Private GrxForm As Graphics
                    Private th1, th2 As Threading.Threa d
                    Private brh As SolidBrush = New SolidBrush(Colo r.Black)
                    Private rnd As Random = New Random
                    Private fnt As Font = New Font("tahoma", 24, FontStyle.Bold)

                    Delegate Sub Drawing(ByVal ID As Integer, ByVal Loc As PointF)
                    Private Dlg As New Drawing(Address Of CommonDraw)

                    Private Done As Boolean

                    Private Sub Button1_Click(B yVal sender As System.Object, ByVal e As System.EventArg s) Handles Button1.Click
                    GrxForm = Me.CreateGraphi cs
                    Th1 = New Threading.Threa d(AddressOf Thread1)
                    Th2 = New Threading.Threa d(AddressOf Thread2)
                    Th1.Start()
                    Th2.Start()
                    End Sub

                    Private Sub CommonDraw(ByVa l ID As Integer, ByVal Loc As PointF)
                    Dim klr As Color = Color.FromArgb( 200, rnd.Next(0, 256), rnd.Next(0, 256), rnd.Next(0, 256))
                    ' The Brush, Font and Graphics are shared
                    brh.Color = klr
                    GrxForm.FillRec tangle(brh, Loc.X, Loc.Y, 80, 50)
                    GrxForm.DrawStr ing(CStr(ID), fnt, Brushes.Black, Loc)
                    End Sub

                    Sub Thread1()
                    Dim id As Integer = 1
                    Dim loc As PointF = New PointF(10, 10)
                    Do While Not Done
                    Me.Invoke(Dlg, New Object() {id, loc})
                    Threading.Threa d.Sleep(100)
                    Loop
                    End Sub

                    Sub Thread2()
                    Dim id As Integer = 2
                    Dim loc As PointF = New PointF(100, 10)
                    Do While Not Done
                    Me.Invoke(Dlg, New Object() {id, loc})
                    Threading.Threa d.Sleep(100)
                    Loop
                    End Sub

                    Private Sub Form1_Closing(B yVal sender As Object, ByVal e As System.Componen tModel.CancelEv entArgs) Handles MyBase.Closing
                    e.Cancel = Done
                    Done = True
                    Application.DoE vents()
                    Th1.Abort()
                    Th2.Abort()
                    End Sub

                    Comment

                    • Larry Serflaten

                      #11
                      Re: Why Does This Fail ( Threading )


                      "Larry Serflaten" <serflaten@usin ternet.com> wrote
                      [color=blue]
                      > Private Sub Form1_Closing(. ..)
                      > e.Cancel = Done
                      > Done = True
                      > Application.DoE vents()
                      > Th1.Abort()
                      > Th2.Abort()
                      > End Sub[/color]


                      Should have been:

                      e.Cancel = Not Done

                      It was meant to cause the first hit on the close button to stop the
                      threads (they take a while to close down) and the second hit to
                      close the form....

                      (Rather than add another button to stop the threads...)

                      LFS

                      Comment

                      • One Handed Man \( OHM - Terry Burns \)

                        #12
                        Re: Why Does This Fail ( Threading )

                        Thanks Larry,

                        I've tried your code out and it seems fine, I'll see if I can work it in to
                        my code and observe the results. Threading is not something Ive had to do
                        much of, so these kinds of issues have not arisen for me. It just goes to
                        show that real work problems provide the best excercies to promote learning.



                        --
                        OHM ( Terry Burns ) * Use the following to email me *

                        Dim ch() As Char = "ufssz/cvsotAhsfbuTpmv ujpotXjui/OFU".ToCharArra y()
                        For i As Int32 = 0 To ch.Length - 1
                        ch(i) = Convert.ToChar( Convert.ToInt16 (ch(i)) - 1)
                        Next
                        Process.Start(" mailto:" & New String(ch))
                        --


                        "Larry Serflaten" <serflaten@usin ternet.com> wrote in message
                        news:eNTqUWBuEH A.3788@TK2MSFTN GP09.phx.gbl...[color=blue]
                        >
                        > "Larry Serflaten" <serflaten@usin ternet.com> wrote
                        >[color=green]
                        >> Private Sub Form1_Closing(. ..)
                        >> e.Cancel = Done
                        >> Done = True
                        >> Application.DoE vents()
                        >> Th1.Abort()
                        >> Th2.Abort()
                        >> End Sub[/color]
                        >
                        >
                        > Should have been:
                        >
                        > e.Cancel = Not Done
                        >
                        > It was meant to cause the first hit on the close button to stop the
                        > threads (they take a while to close down) and the second hit to
                        > close the form....
                        >
                        > (Rather than add another button to stop the threads...)
                        >
                        > LFS[/color]


                        Comment

                        • CJ Taylor

                          #13
                          Re: Why Does This Fail ( Threading )

                          Alright... lets go into more detail... how is it failing...


                          "One Handed Man ( OHM - Terry Burns )" <news.microsoft .com> wrote in message
                          news:uMox$ZAuEH A.1404@TK2MSFTN GP11.phx.gbl...[color=blue]
                          > Same problem
                          >
                          > --
                          > OHM ( Terry Burns ) * Use the following to email me *
                          >
                          > Dim ch() As Char = "ufssz/cvsotAhsfbuTpmv ujpotXjui/OFU".ToCharArra y()
                          > For i As Int32 = 0 To ch.Length - 1
                          > ch(i) = Convert.ToChar( Convert.ToInt16 (ch(i)) - 1)
                          > Next
                          > Process.Start(" mailto:" & New String(ch))
                          > --
                          >
                          >
                          > "CJ Taylor" <cege [ahh ttt] tavayn wooohooo hooo ohhh com> wrote in[/color]
                          message[color=blue]
                          > news:uLdXox8tEH A.3572@tk2msftn gp13.phx.gbl...[color=green]
                          > > Try AutoResetEvent
                          > >
                          > >
                          > > "One Handed Man ( OHM - Terry Burns )" <news.microsoft .com> wrote in
                          > > message news:eoCW9D7tEH A.2536@TK2MSFTN GP11.phx.gbl...[color=darkred]
                          > >> tried declaring at module level, that didnt work. Tried Synclock, that
                          > >> didnt work either
                          > >>
                          > >> --
                          > >> OHM ( Terry Burns ) * Use the following to email me *
                          > >>
                          > >> Dim ch() As Char = "ufssz/cvsotAhsfbuTpmv ujpotXjui/OFU".ToCharArra y()
                          > >> For i As Int32 = 0 To ch.Length - 1
                          > >> ch(i) = Convert.ToChar( Convert.ToInt16 (ch(i)) - 1)
                          > >> Next
                          > >> Process.Start(" mailto:" & New String(ch))
                          > >> --
                          > >>
                          > >>
                          > >> "CJ Taylor" <[cege] at [tavayn] dit commmmm> wrote in message
                          > >> news:eKeG7$5tEH A.2468@TK2MSFTN GP09.phx.gbl...
                          > >>> Don't declare the mutex at the procedure level, perhaps try to at the
                          > >>> module/class level. Otherwise, each time you enter the procedure you
                          > >>> create
                          > >>> a new (and unnamed) mutex variable which the other thread doesn't care
                          > >>> about. So of course it tries to write.
                          > >>>
                          > >>> Alright, so after doing some more reading, was looking at the[/color][/color][/color]
                          waithandle[color=blue][color=green][color=darkred]
                          > >>> and
                          > >>> how that works. Look into AutoResetEvent, in which case its defined[/color][/color][/color]
                          as[color=blue][color=green][color=darkred]
                          > >>> the
                          > >>> threads communicating through events... I can help more in a minute,
                          > >>> but
                          > >>> have to finish something else now and wanted to get this out to you.[/color][/color][/color]
                          It[color=blue][color=green][color=darkred]
                          > >>> inherits from WaitHandle (same as Mutex waitone). but has a few more
                          > >>> options that do the dirty work under the sheets...
                          > >>>
                          > >>> Check it out and let me know if it helps..
                          > >>> -CJ
                          > >>>
                          > >>> I'll write more shortly.
                          > >>>
                          > >>>
                          > >>> "One Handed Man ( OHM - Terry Burns )" <news.microsoft .com> wrote in
                          > >>> message
                          > >>> news:e5cAkk4tEH A.2692@TK2MSFTN GP10.phx.gbl...
                          > >>>> Assumes a Form with a Panel on it., Does the Mutex have to be within
                          > >>>> the
                          > >>>> address of a thread start address ?
                          > >>>>
                          > >>>> Cheers - OHM
                          > >>>>
                          > >>>> '----------- *************** ----------------
                          > >>>>
                          > >>>> Private endProgram As Boolean = False
                          > >>>>
                          > >>>> Dim image1 As Image = Image.FromFile( "..\Images\gun. bmp")
                          > >>>>
                          > >>>> Dim image2 As Image = Image.FromFile( "..\Images\Inva der.bmp")
                          > >>>>
                          > >>>> Dim space As Graphics
                          > >>>>
                          > >>>> Private Sub Button1_Click(B yVal sender As System.Object, ByVal e As
                          > >>>> System.EventArg s) Handles Button1.Click
                          > >>>>
                          > >>>>
                          > >>>>
                          > >>>> Dim Thread1 As New Threading.Threa d(AddressOf Me.WriteImage1)
                          > >>>>
                          > >>>> Dim Thread2 As New Threading.Threa d(AddressOf Me.WriteImage2)
                          > >>>>
                          > >>>> space = Panel1.CreateGr aphics()
                          > >>>>
                          > >>>> Thread1.Start()
                          > >>>>
                          > >>>> Thread2.Start()
                          > >>>>
                          > >>>> End Sub
                          > >>>>
                          > >>>>
                          > >>>>
                          > >>>> Private Sub WriteImage1()
                          > >>>>
                          > >>>> While Not endProgram
                          > >>>>
                          > >>>> DrawImage(space , image1, New Point(10, 10))
                          > >>>>
                          > >>>> End While
                          > >>>>
                          > >>>> End Sub
                          > >>>>
                          > >>>> Private Sub WriteImage2()
                          > >>>>
                          > >>>> While Not endProgram
                          > >>>>
                          > >>>> DrawImage(space , image2, New Point(50, 50))
                          > >>>>
                          > >>>> End While
                          > >>>>
                          > >>>> End Sub
                          > >>>>
                          > >>>> Public Sub DrawImage(ByVal g As Graphics, ByVal i As Image, ByVal p[/color][/color][/color]
                          As[color=blue][color=green][color=darkred]
                          > >>>> Point)
                          > >>>>
                          > >>>> Dim m As New Threading.Mutex
                          > >>>>
                          > >>>> m.WaitOne()
                          > >>>>
                          > >>>> g.DrawImage(i, p)
                          > >>>>
                          > >>>> m.ReleaseMutex( )
                          > >>>>
                          > >>>> End Sub
                          > >>>>
                          > >>>>
                          > >>>> --
                          > >>>> OHM ( Terry Burns ) * Use the following to email me *
                          > >>>>
                          > >>>> Dim ch() As Char =[/color][/color][/color]
                          "ufssz/cvsotAhsfbuTpmv ujpotXjui/OFU".ToCharArra y()[color=blue][color=green][color=darkred]
                          > >>>> For i As Int32 = 0 To ch.Length - 1
                          > >>>> ch(i) = Convert.ToChar( Convert.ToInt16 (ch(i)) - 1)
                          > >>>> Next
                          > >>>> Process.Start(" mailto:" & New String(ch))
                          > >>>> --
                          > >>>>
                          > >>>>
                          > >>>>
                          > >>>
                          > >>>
                          > >>
                          > >>[/color]
                          > >
                          > >[/color]
                          >
                          >[/color]


                          Comment

                          • One Handed Man \( OHM - Terry Burns \)

                            #14
                            Re: Why Does This Fail ( Threading )

                            If you past my code into a form and add a panel etc, you will see. If comes
                            back with a "Object in use elsewhere", Larry posted some code which I tried
                            in the configuration in which he tested it and it seemed to work. I was
                            going to try it out in my code and see what transpires. I'm not particulary
                            experienced at threading so this is newish to me.

                            --
                            OHM ( Terry Burns ) * Use the following to email me *

                            Dim ch() As Char = "ufssz/cvsotAhsfbuTpmv ujpotXjui/OFU".ToCharArra y()
                            For i As Int32 = 0 To ch.Length - 1
                            ch(i) = Convert.ToChar( Convert.ToInt16 (ch(i)) - 1)
                            Next
                            Process.Start(" mailto:" & New String(ch))
                            --


                            "CJ Taylor" <[cege] at [tavayn] dit commmmm> wrote in message
                            news:eNvfTHDuEH A.3524@TK2MSFTN GP15.phx.gbl...[color=blue]
                            > Alright... lets go into more detail... how is it failing...
                            >
                            >
                            > "One Handed Man ( OHM - Terry Burns )" <news.microsoft .com> wrote in
                            > message
                            > news:uMox$ZAuEH A.1404@TK2MSFTN GP11.phx.gbl...[color=green]
                            >> Same problem
                            >>
                            >> --
                            >> OHM ( Terry Burns ) * Use the following to email me *
                            >>
                            >> Dim ch() As Char = "ufssz/cvsotAhsfbuTpmv ujpotXjui/OFU".ToCharArra y()
                            >> For i As Int32 = 0 To ch.Length - 1
                            >> ch(i) = Convert.ToChar( Convert.ToInt16 (ch(i)) - 1)
                            >> Next
                            >> Process.Start(" mailto:" & New String(ch))
                            >> --
                            >>
                            >>
                            >> "CJ Taylor" <cege [ahh ttt] tavayn wooohooo hooo ohhh com> wrote in[/color]
                            > message[color=green]
                            >> news:uLdXox8tEH A.3572@tk2msftn gp13.phx.gbl...[color=darkred]
                            >> > Try AutoResetEvent
                            >> >
                            >> >
                            >> > "One Handed Man ( OHM - Terry Burns )" <news.microsoft .com> wrote in
                            >> > message news:eoCW9D7tEH A.2536@TK2MSFTN GP11.phx.gbl...
                            >> >> tried declaring at module level, that didnt work. Tried Synclock, that
                            >> >> didnt work either
                            >> >>
                            >> >> --
                            >> >> OHM ( Terry Burns ) * Use the following to email me *
                            >> >>
                            >> >> Dim ch() As Char = "ufssz/cvsotAhsfbuTpmv ujpotXjui/OFU".ToCharArra y()
                            >> >> For i As Int32 = 0 To ch.Length - 1
                            >> >> ch(i) = Convert.ToChar( Convert.ToInt16 (ch(i)) - 1)
                            >> >> Next
                            >> >> Process.Start(" mailto:" & New String(ch))
                            >> >> --
                            >> >>
                            >> >>
                            >> >> "CJ Taylor" <[cege] at [tavayn] dit commmmm> wrote in message
                            >> >> news:eKeG7$5tEH A.2468@TK2MSFTN GP09.phx.gbl...
                            >> >>> Don't declare the mutex at the procedure level, perhaps try to at
                            >> >>> the
                            >> >>> module/class level. Otherwise, each time you enter the procedure you
                            >> >>> create
                            >> >>> a new (and unnamed) mutex variable which the other thread doesn't
                            >> >>> care
                            >> >>> about. So of course it tries to write.
                            >> >>>
                            >> >>> Alright, so after doing some more reading, was looking at the[/color][/color]
                            > waithandle[color=green][color=darkred]
                            >> >>> and
                            >> >>> how that works. Look into AutoResetEvent, in which case its defined[/color][/color]
                            > as[color=green][color=darkred]
                            >> >>> the
                            >> >>> threads communicating through events... I can help more in a minute,
                            >> >>> but
                            >> >>> have to finish something else now and wanted to get this out to you.[/color][/color]
                            > It[color=green][color=darkred]
                            >> >>> inherits from WaitHandle (same as Mutex waitone). but has a few more
                            >> >>> options that do the dirty work under the sheets...
                            >> >>>
                            >> >>> Check it out and let me know if it helps..
                            >> >>> -CJ
                            >> >>>
                            >> >>> I'll write more shortly.
                            >> >>>
                            >> >>>
                            >> >>> "One Handed Man ( OHM - Terry Burns )" <news.microsoft .com> wrote in
                            >> >>> message
                            >> >>> news:e5cAkk4tEH A.2692@TK2MSFTN GP10.phx.gbl...
                            >> >>>> Assumes a Form with a Panel on it., Does the Mutex have to be within
                            >> >>>> the
                            >> >>>> address of a thread start address ?
                            >> >>>>
                            >> >>>> Cheers - OHM
                            >> >>>>
                            >> >>>> '----------- *************** ----------------
                            >> >>>>
                            >> >>>> Private endProgram As Boolean = False
                            >> >>>>
                            >> >>>> Dim image1 As Image = Image.FromFile( "..\Images\gun. bmp")
                            >> >>>>
                            >> >>>> Dim image2 As Image = Image.FromFile( "..\Images\Inva der.bmp")
                            >> >>>>
                            >> >>>> Dim space As Graphics
                            >> >>>>
                            >> >>>> Private Sub Button1_Click(B yVal sender As System.Object, ByVal e As
                            >> >>>> System.EventArg s) Handles Button1.Click
                            >> >>>>
                            >> >>>>
                            >> >>>>
                            >> >>>> Dim Thread1 As New Threading.Threa d(AddressOf Me.WriteImage1)
                            >> >>>>
                            >> >>>> Dim Thread2 As New Threading.Threa d(AddressOf Me.WriteImage2)
                            >> >>>>
                            >> >>>> space = Panel1.CreateGr aphics()
                            >> >>>>
                            >> >>>> Thread1.Start()
                            >> >>>>
                            >> >>>> Thread2.Start()
                            >> >>>>
                            >> >>>> End Sub
                            >> >>>>
                            >> >>>>
                            >> >>>>
                            >> >>>> Private Sub WriteImage1()
                            >> >>>>
                            >> >>>> While Not endProgram
                            >> >>>>
                            >> >>>> DrawImage(space , image1, New Point(10, 10))
                            >> >>>>
                            >> >>>> End While
                            >> >>>>
                            >> >>>> End Sub
                            >> >>>>
                            >> >>>> Private Sub WriteImage2()
                            >> >>>>
                            >> >>>> While Not endProgram
                            >> >>>>
                            >> >>>> DrawImage(space , image2, New Point(50, 50))
                            >> >>>>
                            >> >>>> End While
                            >> >>>>
                            >> >>>> End Sub
                            >> >>>>
                            >> >>>> Public Sub DrawImage(ByVal g As Graphics, ByVal i As Image, ByVal p[/color][/color]
                            > As[color=green][color=darkred]
                            >> >>>> Point)
                            >> >>>>
                            >> >>>> Dim m As New Threading.Mutex
                            >> >>>>
                            >> >>>> m.WaitOne()
                            >> >>>>
                            >> >>>> g.DrawImage(i, p)
                            >> >>>>
                            >> >>>> m.ReleaseMutex( )
                            >> >>>>
                            >> >>>> End Sub
                            >> >>>>
                            >> >>>>
                            >> >>>> --
                            >> >>>> OHM ( Terry Burns ) * Use the following to email me *
                            >> >>>>
                            >> >>>> Dim ch() As Char =[/color][/color]
                            > "ufssz/cvsotAhsfbuTpmv ujpotXjui/OFU".ToCharArra y()[color=green][color=darkred]
                            >> >>>> For i As Int32 = 0 To ch.Length - 1
                            >> >>>> ch(i) = Convert.ToChar( Convert.ToInt16 (ch(i)) - 1)
                            >> >>>> Next
                            >> >>>> Process.Start(" mailto:" & New String(ch))
                            >> >>>> --
                            >> >>>>
                            >> >>>>
                            >> >>>>
                            >> >>>
                            >> >>>
                            >> >>
                            >> >>
                            >> >
                            >> >[/color]
                            >>
                            >>[/color]
                            >
                            >[/color]


                            Comment

                            • One Handed Man \( OHM - Terry Burns \)

                              #15
                              Re: Why Does This Fail ( Threading )

                              Actually, thinking about this more before I try and implement it.

                              My Invader and Gun classes are responsible for doing their own drawing, in
                              this case they both have to use the/a delegate in which case perhaps I need
                              to raise an event as they do not have an Invoke method as a form does.

                              Sorry, but I feel really feel like I cant think my way out of a paper bag
                              today :(

                              --
                              OHM ( Terry Burns ) * Use the following to email me *

                              Dim ch() As Char = "ufssz/cvsotAhsfbuTpmv ujpotXjui/OFU".ToCharArra y()
                              For i As Int32 = 0 To ch.Length - 1
                              ch(i) = Convert.ToChar( Convert.ToInt16 (ch(i)) - 1)
                              Next
                              Process.Start(" mailto:" & New String(ch))
                              --


                              "Larry Serflaten" <serflaten@usin ternet.com> wrote in message
                              news:eNTqUWBuEH A.3788@TK2MSFTN GP09.phx.gbl...[color=blue]
                              >
                              > "Larry Serflaten" <serflaten@usin ternet.com> wrote
                              >[color=green]
                              >> Private Sub Form1_Closing(. ..)
                              >> e.Cancel = Done
                              >> Done = True
                              >> Application.DoE vents()
                              >> Th1.Abort()
                              >> Th2.Abort()
                              >> End Sub[/color]
                              >
                              >
                              > Should have been:
                              >
                              > e.Cancel = Not Done
                              >
                              > It was meant to cause the first hit on the close button to stop the
                              > threads (they take a while to close down) and the second hit to
                              > close the form....
                              >
                              > (Rather than add another button to stop the threads...)
                              >
                              > LFS[/color]


                              Comment

                              Working...