if im using a form on the reciving thread.
u recommend to use the OnNotifyMessage event of the form
and postmessage from the sender thread , or there is a nicer way ?
Dmitriy Lapshin said:
Seems that the Win32 API is the only choice. But I can confirm it works
pretty well in .NET.
Assuming you have a reference to the form, just call a method or set a
property that the thread method looks for on each loop. This property could
be a bool, int, struct, class, etc.
--
William Stacey, MVP
Daylor said:
if im using a form on the reciving thread.
u recommend to use the OnNotifyMessage event of the form
and postmessage from the sender thread , or there is a nicer way ?
Dmitriy Lapshin said:
Seems that the Win32 API is the only choice. But I can confirm it works
pretty well in .NET.
If you are posting to the thread, and not to a specific window, then you
will have to have something that implements the IMessageFilter interface,
and then pass that implementation to the static AddMessageFilter method on
the Application class, so it can handle the message that comes in on the
thread.
From the other thread, you will have to use the PostThreadMessage API
method through the P/Invoke layer.
Hope this helps.
--
- Nicholas Paldino [.NET/C# MVP]
- (e-mail address removed)
Daylor said:
if im using a form on the reciving thread.
u recommend to use the OnNotifyMessage event of the form
and postmessage from the sender thread , or there is a nicer way ?
Dmitriy Lapshin said:
Seems that the Win32 API is the only choice. But I can confirm it works
pretty well in .NET.
Want to reply to this thread or ask your own question?
You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.