post message to other thread in net

  • Thread starter Thread starter Daylor
  • Start date Start date
D

Daylor

how , can i post message to other thread in net ?
is there somthing with net that i can do ?
or i need 2 use win32 api's ?
 
Seems that the Win32 API is the only choice. But I can confirm it works
pretty well in .NET.
 
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.

--
Dmitriy Lapshin [C# / .NET MVP]
X-Unity Test Studio
http://x-unity.miik.com.ua/teststudio.aspx
Bring the power of unit testing to VS .NET IDE

Daylor said:
how , can i post message to other thread in net ?
is there somthing with net that i can do ?
or i need 2 use win32 api's ?
 
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.

--
Dmitriy Lapshin [C# / .NET MVP]
X-Unity Test Studio
http://x-unity.miik.com.ua/teststudio.aspx
Bring the power of unit testing to VS .NET IDE

Daylor said:
how , can i post message to other thread in net ?
is there somthing with net that i can do ?
or i need 2 use win32 api's ?
 
Daylor,

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.

--
Dmitriy Lapshin [C# / .NET MVP]
X-Unity Test Studio
http://x-unity.miik.com.ua/teststudio.aspx
Bring the power of unit testing to VS .NET IDE

Daylor said:
how , can i post message to other thread in net ?
is there somthing with net that i can do ?
or i need 2 use win32 api's ?
 
Back
Top