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. .NET (Core and Framework)
  4. [SOS] about API(SendMessage or PostMessage)

[SOS] about API(SendMessage or PostMessage)

Scheduled Pinned Locked Moved .NET (Core and Framework)
csharpjson
4 Posts 2 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.
  • C Offline
    C Offline
    cnet2008
    wrote on last edited by
    #1

    :wtf:I'm using THE api(SendMessage or PostMessage) to send a custom message between 2 C# exe's. The called exe is subclassed to listen to the custom message. In the calling exe, I'm trying to pass a string in the 4th parameter. At this stage the 2nd exe is already running. The api call keeps crashing the 2nd exe. Can it be done across exe's or only within the same exe, thanks. thanks for your apply or provide sample code( the best :laugh:) you are welcome to visit my blog

    C 1 Reply Last reply
    0
    • C cnet2008

      :wtf:I'm using THE api(SendMessage or PostMessage) to send a custom message between 2 C# exe's. The called exe is subclassed to listen to the custom message. In the calling exe, I'm trying to pass a string in the 4th parameter. At this stage the 2nd exe is already running. The api call keeps crashing the 2nd exe. Can it be done across exe's or only within the same exe, thanks. thanks for your apply or provide sample code( the best :laugh:) you are welcome to visit my blog

      C Offline
      C Offline
      cnet2008
      wrote on last edited by
      #2

      Using SendMessage API to control external app: have an external application that I need to be able to control. I've tried using SendKeys but due to the obvious limitations of this function the behavior is erratic. I know you can do this using the SendMessage API ( find the handle of the external application's window ,first ) ,but I'm not sure how to do it. can you provide the sameple code to me ,please? you are welcome to visit my blog

      S 1 Reply Last reply
      0
      • C cnet2008

        Using SendMessage API to control external app: have an external application that I need to be able to control. I've tried using SendKeys but due to the obvious limitations of this function the behavior is erratic. I know you can do this using the SendMessage API ( find the handle of the external application's window ,first ) ,but I'm not sure how to do it. can you provide the sameple code to me ,please? you are welcome to visit my blog

        S Offline
        S Offline
        Saksida Bojan
        wrote on last edited by
        #3

        By trying using SendMessage API i got: C:\Projecti\test\Form1.cs(77): 'System.Windows.Forms.Control.SendMessage(int, int, int)' is inaccessible due to its protection level This API is from Platform SDK and i think it doesn't support in C#. To get handle, you can call GetActiveWindow or FindWindow

        C 1 Reply Last reply
        0
        • S Saksida Bojan

          By trying using SendMessage API i got: C:\Projecti\test\Form1.cs(77): 'System.Windows.Forms.Control.SendMessage(int, int, int)' is inaccessible due to its protection level This API is from Platform SDK and i think it doesn't support in C#. To get handle, you can call GetActiveWindow or FindWindow

          C Offline
          C Offline
          cnet2008
          wrote on last edited by
          #4

          I can do it now I can use FindWindow,GetWindow and SendMessage to send message to a notepad app,just like this: hWnd1 = FindWindow(null, "Untitled - Notepad"); hWnd2 = GetWindow(hWnd1, GW_CHILD); sText =this.textBox1.Text; SendMessage (hWnd2, WM_SETTEXT,sText.Length, sText); but I don't know how to excute a word app's dictate by another app,help me please ,thank you! you are welcome to visit my blog

          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