1

I have an older vb6 app I am working with and a new one in c# and use SendMessage to send messages between them, with the c# program working functionally as a form within the vb6 app.

Sometimes, and not with a pattern I can see, messages do not get sent to the c# program. This can usually be corrected by clicking on the c# program in taskbar and then going back to the vb6 app and trying again at which point it will start working again.

When it is not working I am able to put a breakpoint in the WndProc method and see that it does not trigger.

I have been unable to figure out how to make this communication inconsistent.

Code handling this:

protected override void WndProc(ref Message message)
    {
        if (message.Msg == 0x400 + 5)
        {
            if (message.LParam != (IntPtr)0)
            {
                StringBuilder += (char)message.LParam;
            }
            else
            {
                handleIncMessage(StringBuilder);
                StringBuilder = "";
            }
        }

        //be sure to pass along all messages to the base also
        base.WndProc(ref message);
    }

I tried this method: https://stackoverflow.com/a/7033382/821665 but unfortunately it did not work.

Community
  • 1
  • 1
Bryan
  • 623
  • 1
  • 6
  • 23
  • Can you share some code? – Mustafa Chelik May 09 '14 at 21:11
  • @Mustafa Sorry I missed your comment initially, I found it was happening when the window was minimized and so searching for that led me to this answer: http://stackoverflow.com/a/7033382/821665. I can't try it for a little while yet but it looks like that should solve my problem. – Bryan May 12 '14 at 15:54
  • @Mustafa I tried out that answer but unfortunately it did not work, and have added code for how I am currently doing it – Bryan May 12 '14 at 17:01

0 Answers0