0

I'm looking for an example code written in C# how do I the communication of my application with another application using. I have an another application that have an ComboBox. I want set the value of this Combobox from my application, using C# code.

5
  • Have you done any research? WCF comes to mind.
    – M.Babcock
    Feb 3, 2012 at 2:12
  • @Jack, please check if my edit/re-tagging matches what you asking. Note that it may be good idea to state your overall goal as there are much better ways of communicating between processes. Feb 3, 2012 at 2:15
  • Can you explain more, what this has to do with ui automation? Feb 3, 2012 at 2:17
  • @zespri, This is how I read - "I want set the value of this Combobox from my application", could be totally off. Should not have put it in it I guess - removing till Jack is back... Feb 3, 2012 at 2:20
  • Google "hooking in C#", which is what you need.
    – Holystream
    Feb 3, 2012 at 2:23

4 Answers 4

4

you can use a number of technologies.... none are super simple.

  • Sockets
  • MSMQ
  • Named Pipes
  • WCF ( which wraps the three above, and other techniques, can be a bit fiddly to get working)
  • DCOM
  • Windows "SendMessage"
  • Files
  • Shared Memory
1
  • 1
    You forgot named pipes which WCF also wraps.
    – M.Babcock
    Feb 3, 2012 at 2:17
1

You need to learn and use Windows Communication Foundation. Have a look at MSDN article - What Is Windows Communication Foundation?

1

In your case, there are two ways:

  1. RPC, the preferred way. the 'other' app should expose RPC API, you the app can invoke and communicate with the 'other' app;
  2. UI Automation, the bad way. You can use Windows API to get a handle of the ComboBox in the 'other' app, and send key stroke event to stimulate human interaction. But it is not reliable. E.g. you cannot lock your screen when the app is running, or you cannot stimulate the action.
1
  • You can access Win32 API to Block Input which disables keyboard and mouse input to prevent user interaction Feb 3, 2012 at 2:26
0

Some code samples can be found here: http://1code.codeplex.com/wikipage?title=IRPC

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.