Using GetMessage in C#
-
Just curious why would you want to send a string message between the applications? Sending windows messages would be much more standard way of communicating between applications. Ben
You're right. I didn't explain myself correctly. What I want to do is send string data using windows messages. Thanks !
p.f. Goudjo-Ako Bringing our energy together !
-
You're right. I didn't explain myself correctly. What I want to do is send string data using windows messages. Thanks !
p.f. Goudjo-Ako Bringing our energy together !
-
Here is an article I wrote that has two .net applications sending and receiving windows messages. http://www.codeproject.com/dotnet/windowsappsingleinstance.asp[^] Hope that helps. Ben
Thanks Kubben ! Pat.
p.f. Goudjo-Ako Bringing our energy together !
-
Here is an article I wrote that has two .net applications sending and receiving windows messages. http://www.codeproject.com/dotnet/windowsappsingleinstance.asp[^] Hope that helps. Ben
Hello I've seen your article but I still do not understand How can I intercept a message into one c# application the message will be send from another csharp application using user32.dll API
\[DllImport("user32.dll")\] static extern IntPtr SendMessage(IntPtr hWnd, UInt32 Msg, IntPtr wParam, \[MarshalAs(UnmanagedType.LPStr)\] string lParam);
-
Hello I've seen your article but I still do not understand How can I intercept a message into one c# application the message will be send from another csharp application using user32.dll API
\[DllImport("user32.dll")\] static extern IntPtr SendMessage(IntPtr hWnd, UInt32 Msg, IntPtr wParam, \[MarshalAs(UnmanagedType.LPStr)\] string lParam);
-
First I need to ask why you want to use sendmessage to communicate between to applications. There are better ways of doing this. Ben
-
Hello Thank for your reply No particular reason I just need the best way to send string parameter from one running .NET app to another running one The second should trigger an event when receiving a message
Well, If you just want it to trigger an event in the second app, they my article should work ok. Windows message won't allow you to pass a string in. So if the string it self is important you will have to do something different. If the string has certain characters that should cause something to trigger in the second app, you can just check for those in the first app and then send a windows message. Let me know if the string is important to the second app or not. Ben
-
Well, If you just want it to trigger an event in the second app, they my article should work ok. Windows message won't allow you to pass a string in. So if the string it self is important you will have to do something different. If the string has certain characters that should cause something to trigger in the second app, you can just check for those in the first app and then send a windows message. Let me know if the string is important to the second app or not. Ben
Hello Kubben Yes the string is important APP A (.NET) is running APP A require a Form from APP B (.NET) To show user "abc" So I check if APP B is already running If NO : I launch it using Process.Start("APP B","abc"); If YES : I want to trigger an event for APP B to show user "abc"
-
Hello Kubben Yes the string is important APP A (.NET) is running APP A require a Form from APP B (.NET) To show user "abc" So I check if APP B is already running If NO : I launch it using Process.Start("APP B","abc"); If YES : I want to trigger an event for APP B to show user "abc"
Well, You can try using FindWindow to get the second app windows handle. Then you should be able to send a string to it. There are some examples out there. I found this one: http://social.msdn.microsoft.com/forums/en-US/vbinterop/thread/62d0c25f-dadb-4b24-9679-f9f75717456c/ Hopefully, that helps. Ben
-
Well, You can try using FindWindow to get the second app windows handle. Then you should be able to send a string to it. There are some examples out there. I found this one: http://social.msdn.microsoft.com/forums/en-US/vbinterop/thread/62d0c25f-dadb-4b24-9679-f9f75717456c/ Hopefully, that helps. Ben