Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. C#
  4. correct way in c# to...

correct way in c# to...

Scheduled Pinned Locked Moved C#
csharpc++javaquestion
3 Posts 3 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • R Offline
    R Offline
    rocky_pulley
    wrote on last edited by
    #1

    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

    C S 2 Replies Last reply
    0
    • R rocky_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

      C Offline
      C Offline
      Carsten Zeumer
      wrote on last edited by
      #2

      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

      1 Reply Last reply
      0
      • R rocky_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

        S Offline
        S Offline
        S Senthil Kumar
        wrote on last edited by
        #3

        You can use BeginInvoke and Invoke on the System.Windows.Forms.Control class. This[^] article explains the gory details. Regards Senthil _____________________________ My Blog | My Articles | WinMacro

        1 Reply Last reply
        0
        Reply
        • Reply as topic
        Log in to reply
        • Oldest to Newest
        • Newest to Oldest
        • Most Votes


        • Login

        • Don't have an account? Register

        • Login or register to search.
        • First post
          Last post
        0
        • Categories
        • Recent
        • Tags
        • Popular
        • World
        • Users
        • Groups