473,494 Members | 2,223 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

Mouse move multithreading problem

Dear all,
picturebox mouse move seems to start new thread each time it is called.
At least I see in debuger many threads.
---Non user code--
Picturebox.MouseMove

This seems to spoil my algorithm.
SyncLock Me
Do()
EndSyncloc

Don't fixes the problem.
Any advice would be greatly apreciated.
Best regards,
Boni
Nov 21 '05 #1
5 1630
"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/>

Nov 21 '05 #2
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]" <hi***************@gmx.at> schrieb im Newsbeitrag
news:OC**************@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/>

Nov 21 '05 #3
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:el**************@TK2MSFTNGP14.phx.gbl...
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]" <hi***************@gmx.at> schrieb im
Newsbeitrag news:OC**************@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/>


Nov 21 '05 #4
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:
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:el**************@TK2MSFTNGP14.phx.gbl...
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]" <hi***************@gmx.at> schrieb im
Newsbeitrag news:OC**************@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/>



Nov 21 '05 #5
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" <Tr******@discussions.microsoft.com> schrieb im Newsbeitrag
news:81**********************************@microsof t.com...
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:
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:el**************@TK2MSFTNGP14.phx.gbl...
> 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]" <hi***************@gmx.at> schrieb im
> Newsbeitrag news:OC**************@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/>
>
>


Nov 21 '05 #6

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
17288
by: Csaba2000 | last post by:
I have set onmousedown to change the cursor, but this setting is ignored (IE 5.5; NN 6.1 on Win 2K Pro) until the mouse is either moved or the mouse button is released. On Opera 7.01, the setting...
1
7640
by: suhas | last post by:
Hi, I have an MDI app that allows user to create flowcharts. User can drag flowchart objects (squares, rectangles, elipses, etc) from the toolbar and put on a form. They should be able to move...
6
10807
by: Carlos García-Carazo | last post by:
Hello, I am working on a C# application for an industrial machine, using Windows Forms, where the user could look at the screen from a 90 degree rotated position, like he could turn the monitor...
1
19050
by: Benny Raymond | last post by:
In my attempt to make a macro recording program where i can then playback mouse movements i'm running into a big problem: I'm trying to simulate the movement of the mouse to a point on the...
1
2442
by: Boni | last post by:
Dear all, A mouse click on some object in my application should select this object, where mouse down should start moving until mouse up. But, when I press mouse down small move always happens. I...
6
7226
by: Rob | last post by:
This is a curious problem. It seems like it should be quite easy. Of course a timer is used to determine when form should be closed, but how do you consistently reset the timer when the mouse is...
0
2405
by: hmm | last post by:
Hi all I have two problems: Problem #1: I'm using a .NET Form with the property 'FormBorderStyle' set to 'None'. The idea is to completely cover the area of that Form with a UserControl. In...
19
5904
by: wmanzo | last post by:
I have a really professional conspiracy movie site and I use tons of layers and an external scroll bar assembly. I would like to put the various sections into MS Iframes and in order to clean up...
4
6947
by: mike | last post by:
I have the opportunity to rescue a project that uses a mouse to sense the relative position of a machine. The hardware is built...just needs to be programmed. Stop snickering!!! I didn't do it...I...
0
7119
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
6989
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
7157
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
7195
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
1
6873
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
7367
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
5453
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
1
4889
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
285
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.