0

I have an applicaion in Winform and this application is launched from cmd. I want to launch my winform application once and like to send messages to winform application. Also, when I like to close my winform application from cmd.

I have written the Winform application in C#.

Please guide me.

Thanks in advance.

-Harsha

Harsha
  • 1,861
  • 7
  • 28
  • 56

2 Answers2

3

I think you should use function FindWindow and SendMessage. Also you should overide WindProc in your C# application to process input messages.

Anton Semenov
  • 6,227
  • 5
  • 41
  • 69
  • Thank you very much. Finally, I created one more console application and sending messages to my winform app. – Harsha Feb 23 '11 at 05:04
2

I am not sure why you would want to do what you just described. But if you are looking at a generic way to control a winform application from another application, you can take a look at named pipes(.NET 3.5+). Otherwise you can do this by using a tcp socket in loopback mode.

Saibal
  • 802
  • 6
  • 15