| re: Mouse move multithreading problem
Dear Sirs,
I do not understand,
If MouseMove started and is still running, but other MouseMove event happens
will it wait until first one is finished? How can I force this behavoir?
Thank you very much,
Boni
"TrtnJohn" <TrtnJohn@discussions.microsoft.com> schrieb im Newsbeitrag
news:81314A38-C5A7-4A87-8A26-39EAEA88C6C1@microsoft.com...[color=blue]
> Each event returned by your control is NOT on a different thread. Each
> windows application has a single UI thread which is processing events.
> Your
> event handler routines are called from this single UI thread whenever an
> event is received by the window. In the background Windows messages are
> being processed and routed to each window handle. Your MouseMove event
> handler will receive each event synchronously so there is no need for
> SyncLock.
>
> "Boni" wrote:
>[color=green]
>> I added to DoMove a flag to see, if I am right about the multithreading,
>> and
>> assertion often fails.
>>
>> Dim a As Boolean = False
>>
>> Sub DoMove()
>>
>> SyncLock m_Graph
>>
>> If (a) Then
>>
>> Debug.assert(false, "Multithreading!!!!")
>>
>> End If
>>
>>
>>
>>
>>
>> a = True
>>
>> ....
>>
>>
>>
>> Recalculate()
>> a=false
>>
>> End SyncLock
>> ....
>>
>> "Boni" <oilia@nospam> schrieb im Newsbeitrag
>> news:eljQBIbzFHA.2076@TK2MSFTNGP14.phx.gbl...[color=darkred]
>> > Dear Herfried,
>> > I use NET 1.1.
>> >
>> > Private Sub PictureBox1_MouseMove(ByVal sender As Object, ByVal e As
>> > System.Windows.Forms.MouseEventArgs) Handles PictureBox1.MouseMove
>> >
>> > DoMove()
>> >
>> > PictureBox1.Invalidate()
>> >
>> > End Sub
>> >
>> > Sub DoMove()
>> >
>> > SyncLock m_Graph
>> >
>> > Recalculate()
>> >
>> > End SyncLock
>> >
>> > End Sub
>> >
>> >
>> >
>> > If some of internal assertions in Recalculate fails, I see in a
>> > debugger
>> > not only one stack, but many of them.
>> >
>> >
>> >
>> >
>> >
>> > "Herfried K. Wagner [MVP]" <hirf-spam-me-here@gmx.at> schrieb im
>> > Newsbeitrag news:OC6ZaJZzFHA.1032@TK2MSFTNGP12.phx.gbl...
>> >> "Boni" <oilia@nospam> schrieb:
>> >>> picturebox mouse move seems to start new thread each time it is
>> >>> called.
>> >>> At least I see in debuger many threads.
>> >>
>> >> I am not able to reproduce this behavior with .NET 1.1. Are you
>> >> talking
>> >> about the control's 'MouseMove' event? Please post the relevant parts
>> >> of
>> >> your source code.
>> >>
>> >> --
>> >> M S Herfried K. Wagner
>> >> M V P <URL:http://dotnet.mvps.org/>
>> >> V B <URL:http://classicvb.org/petition/>
>> >
>> >[/color]
>>
>>
>>[/color][/color] |