howard39
Wed Sep 21 19:11:02 CDT 2005
Jerffry, I am having a problem getting the method that you suggested, using a
hidden window, to work. I can send the message (using PostMessage with
HWND_BROADCAST), and I can receive it in my Form.WndProc override in AppB
provided the form's window is not hidden. But when I hide the window, I don't
receive any messages in WndProc.
Did you mean that I have to actually *show* the window in AppB (which I
cannot do in the production case)? Or is there a way to create a message loop
and a WndProc without displaying a Window?
According to the dot net documentation, if I were to call Application.Run()
without any argument, it would begin "running a standard application message
loop on the current thread, without a form." This seems to imply that I can
create a WndProc without showing a window. But then how do I get access to
the WndProc?
--Howard
""Jeffrey Tan[MSFT]"" wrote:
> Hi howard39,
>
> Thanks for your post.
>
> Normally, what you want to do is inter-process communication. However, in
> .Net, there is few support for inter-process communication. We have to
> resort to Win32 ways to get this done.
>
> For example, we may show a hidden window in AppB, then register a certain
> message for inter-process communication with p/invoke RegisterWindowMessage
> API. And handling this message in hidden window's WndProc. Then in AppA, we
> can invoke RegisterWindowMessage with the same string, and use SendMessage
> to send this application wide message to AppB, and AppB will get
> notification, then do anything it can.
>
> If you do not want to show a hidden window in AppB, and there is no message
> loops in AppB, we have to use some other inter-process communication
> technology to do this, such as sockets, named pipe, memory mapped file,
> etc.., please refer to the article below:
> "Inter-Process Communication in .NET Using Named Pipes, Part 1"
>
http://www.codeproject.com/csharp/DotNetNamedPipesPart1.asp
> "DevGlobalCache ¨C A way to Cache and Share data between processes"
>
http://www.codeproject.com/dotnet/globalcache.asp
>
> Also, you may use .Net remoting to do cross appdomain communication.
>
> Hope this helps
>
> Best regards,
> Jeffrey Tan
> Microsoft Online Partner Support
> Get Secure! - www.microsoft.com/security
> This posting is provided "as is" with no warranties and confers no rights.
>
>