var options = new Options();
ICommandLineParser parser = new CommandLineParser();
if (parser.ParseArguments(args, options))
{
m_ReceiverHandel = (IntPtr)options.Handle;
if (options.IsBrowser)
{
var browserTab = new WebBrowserPage()
{
StartPosition = FormStartPosition.Manual,
Top = -3200,
Left = -3200,
Width = 0,
Height = 0
};
browserTab.TextChanged += browserTab_TextChanged;
Application.Run(browserTab);
return;
}
}
Application.Run(new MainForm());
}</pre>
var host = new ApplicationHost()
{
File = Application.ExecutablePath,
Arguments = string.Format("-b -h {0}", this.Handle),
HideApplicationTitleBar = true,
Dock = DockStyle.Fill
};
host.ProcessLoaded += host_ProcessLoaded;
host.ProcessUnLoaded += host_ProcessUnLoaded;
tabpage.Controls.Add(host);
}</pre>
var cds = new CopyDataStruct();
cds.cbData = buffer.Length;
cds.dwData = browserTab.Handle;
cds.lpData = Marshal.AllocHGlobal(buffer.Length);
Marshal.Copy(buffer, 0, cds.lpData, buffer.Length);
SendMessage(m_ReceiverHandel, WM_COPYDATA, 0x401, ref cds);
}</pre>
m_HostPool[cds.dwData].Parent.Text = Marshal.PtrToStringAnsi(cds.lpData, cds.cbData);
}
base.WndProc(ref m);
}</pre>