correct way in c# to...
-
Hi, I have a user thread and I need to tell it to run some code in the GUI thread. I was thinking that maybe I would use SendMessage and create a message handler for this but it sounds like more of a C/C++ way of doing it. Is there something in C# line this? Kind of like java has SwingUtilities.invokeLater() -- Rocky Dean Pulley
-
Hi, I have a user thread and I need to tell it to run some code in the GUI thread. I was thinking that maybe I would use SendMessage and create a message handler for this but it sounds like more of a C/C++ way of doing it. Is there something in C# line this? Kind of like java has SwingUtilities.invokeLater() -- Rocky Dean Pulley
Actually SendMessage is not directly implemented in the CLR. You should use the BeginInvoke to call code in the UI thread from another thread. Google for BeginInvoke and UI or read this article: http://www.codeproject.com/csharp/winformthreading.asp[^] /cadi 24 hours is not enough
-
Hi, I have a user thread and I need to tell it to run some code in the GUI thread. I was thinking that maybe I would use SendMessage and create a message handler for this but it sounds like more of a C/C++ way of doing it. Is there something in C# line this? Kind of like java has SwingUtilities.invokeLater() -- Rocky Dean Pulley
You can use
BeginInvoke
andInvoke
on theSystem.Windows.Forms.Control
class. This[^] article explains the gory details. Regards Senthil _____________________________ My Blog | My Articles | WinMacro