Here is my WndProc. I am expecting that when I am calling through Skype from my apps then controls should come to this if
block repeatedly but I saw only it coming once.
if (m.Msg == NativeCalls.WM_COPYDATA && m.WParam == NativeCalls.HWND_BROADCAST)
Where am I making a mistake? Can anyone guide me?
protected override void WndProc(ref Message m)
{
Boolean handled = false;
if (m.Msg == NativeCalls.APIAttach && (uint) m.LParam == NativeCalls.SKYPECONTROLAPI_ATTACH_SUCCESS)
{
// Get the current handle to the Skype window
NativeCalls.HWND_BROADCAST = m.WParam;
handled = true;
m.Result = new IntPtr(1);
}
// Skype sends our program messages using WM_COPYDATA. the data is in lParam
if (m.Msg == NativeCalls.WM_COPYDATA && m.WParam == NativeCalls.HWND_BROADCAST)
{
COPYDATASTRUCT data = (COPYDATASTRUCT)Marshal.PtrToStructure(m.LParam, typeof(COPYDATASTRUCT));
StatusTextBox.Items.Add(data.lpData + Environment.NewLine);
// Check for connection
//if (data.lpData.IndexOf("CONNSTATUS ONLINE") > -1)
// ConnectButton.IsEnabled = false;
// Check for calls
IsCallInProgress(data.lpData);
handled = true;
m.Result = new IntPtr(1);
}
m.Result = IntPtr.Zero;
if (handled) DefWndProc(ref m); else base.WndProc(ref m);
//base.WndProc(ref m);
}
here i attach the link of my win application and that is https://onedrive.live.com/#cid=C4A6F16F34D7540A&id=C4A6F16F34D7540A!126 just download the skypecalltest and run it.
before run my apps just login to skype and then run my apps where you put a phone no and click on call button then you can see the controls is not coming repeatedly to the second if block.
so what i need to change in my code as a result control will come to second if block.
in the same link there is another same kind of apps which is based on wpf. that is working where wndproc
is calling repeatedly. if possible check that code too and guide me what i am missing or making mistake. thanks
thanks