Well I worked on your problem for a while and Iâve been able to do pretty much all u wanted to do.
Just follow me.
This namespace is required so add it to your project.
Code:
using System.Runtime.InteropServices;
.
.
.
DDE message constants you will be using later
Code:
private const int WM_DDE_INITIATE = 0x03E0;
private const int WM_DDE_EXECUTE = WM_DDE_INITIATE+8;
.
.
.
U need to map SendMessage so establish DDE communication with the Shell
Code:
[DllImport("user32.dll")]
Code:
public static extern int SendMessage(
IntPtr h, int m, IntPtr Wp, int Lp);
I mentioned in my previous posts, you have to override WndProc.
so the WndProc..
Code:
[System.Security.Permissions.PermissionSet(System.Security.Permissions.SecurityAction.Demand, Name="FullTrust")]
Code:
protected override void WndProc(ref Message m)
{
// Listen for operating system messages.
switch (m.Msg)
{
case WM_DDE_EXECUTE:
MessageBox.Show("WM_DDE_EXECUTE");
SendMessage(m.WParam,WM_DDE_ACK,this.Handle,0);
break;
case WM_DDE_INITIATE:
MessageBox.Show("WM_DDE_INITIATE");
SendMessage(m.WParam,WM_DDE_ACK,this.Handle,0);
break;
}
base.WndProc(ref m);
}
I can safely say that almost all your work is done.
Do update the forum with the completed solution once you are through with it.
Regards
Ankur Verma