{I+=codeWee;}
[C#] How to call eachother between WinForm and WebControl
//C# -----------------------------------------------
...
using System.Security.Permissions;
...

	[PermissionSet(SecurityAction.Demand, Name = "FullTrust")]
	[System.Runtime.InteropServices.ComVisibleAttribute(true)]
	public partial class MainForm : Form
	{
	...

		public MainForm()
		{
			...
			webBrowser1.ObjectForScripting = this; 
		}
	...
		// Javascript -> WinForm
		public void FunctionFromHTML()
		{
		...
		}
	...
		// Winform -> Javascript
		public void CallJavascriptFunction()
		{
			webBrowser1.Document.InvokeScript("FunctionFromWinForm", new object[]{ "text" });
		}
	}



//HTML -----------------------------------------

//Javascript -> WinForm
window.external.FunctionFromHTML();

// Winform -> Javascript
function FunctionFromWinForm(v)
{
...
}
HTML | PHP | C++ | DirectX11 | Javascript | C# | HTML5 | ASP | SQL | General | CSS | Oculus Rift | Unity3d | Virtools SDK | Tip | NSIS | PowerShell | node.js | Web API | RTSP | All
Copyright© 2016 CodeWee.com All rights reserved.