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. Sending message to another process

Sending message to another process

Scheduled Pinned Locked Moved C#
csharpjsonquestion
6 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.
  • A Offline
    A Offline
    aljodav
    wrote on last edited by
    #1

    I need to send WM_COPYATA to another process from a C# program. Is there a C# method (maybe a class) equivalent to the Win32 API SendMessage(HWND h, ...) ?

    S 1 Reply Last reply
    0
    • A aljodav

      I need to send WM_COPYATA to another process from a C# program. Is there a C# method (maybe a class) equivalent to the Win32 API SendMessage(HWND h, ...) ?

      S Offline
      S Offline
      Sathesh Sakthivel
      wrote on last edited by
      #2

      MSDN[^]Article will help you.

      Regards, Satips.

      A 2 Replies Last reply
      0
      • S Sathesh Sakthivel

        MSDN[^]Article will help you.

        Regards, Satips.

        A Offline
        A Offline
        aljodav
        wrote on last edited by
        #3

        Thanks :cool:, Satips.

        1 Reply Last reply
        0
        • S Sathesh Sakthivel

          MSDN[^]Article will help you.

          Regards, Satips.

          A Offline
          A Offline
          aljodav
          wrote on last edited by
          #4

          Thanks, Satips, but in fact it didn't help me. I'm converting a working MFC program to C# and the only thing I stuck on is sending WM_COPYDATA message to another process, and the article doesn't say which method or class I should use (maybe I should use interop ?). Thanks anyway.

          S 1 Reply Last reply
          0
          • A aljodav

            Thanks, Satips, but in fact it didn't help me. I'm converting a working MFC program to C# and the only thing I stuck on is sending WM_COPYDATA message to another process, and the article doesn't say which method or class I should use (maybe I should use interop ?). Thanks anyway.

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

            You could simply use P/Invoke SendMessage using this[^] p/invoke declaration. To get the window handle of the other process, you can use Process.GetProcess to get the process object for the other process and then use the MainWindowHandle property to get the window handle. You would also need to use the actual value of WM_COPYDATA (0x004A), as that enum doesn't exist in C#.

            Regards Senthil [MVP - Visual C#] _____________________________ My Blog | My Articles | My Flickr | WinMacro

            A 1 Reply Last reply
            0
            • S S Senthil Kumar

              You could simply use P/Invoke SendMessage using this[^] p/invoke declaration. To get the window handle of the other process, you can use Process.GetProcess to get the process object for the other process and then use the MainWindowHandle property to get the window handle. You would also need to use the actual value of WM_COPYDATA (0x004A), as that enum doesn't exist in C#.

              Regards Senthil [MVP - Visual C#] _____________________________ My Blog | My Articles | My Flickr | WinMacro

              A Offline
              A Offline
              aljodav
              wrote on last edited by
              #6

              Thanks Senthil, I got it. :cool:

              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