VB.NET - hw to call the javascript file in panel in vb.net

Asked By rajeshwari balu on 23-Nov-11 03:44 AM
Hi

     I am creating the windows application, In this i want to call the javascript file in panel in vb.net. My coding is


Dim pFoundWindow As New IntPtr

proc1.StartInfo.FileName = Application.StartupPath + "\" + "testtelnet.js"

proc1.StartInfo.CreateNoWindow = True

proc1.StartInfo.WindowStyle = ProcessWindowStyle.Minimized

proc1.Start()


Threading.Thread.Sleep(1000)

pFoundWindow = proc1.MainWindowHandle


SetParent(pFoundWindow,



Me.Panel2.Handle)

SendMessage(pFoundWindow, WM_SYSCOMMAND, SC_MAXIMIZE, 0)


In this, the process (testtelnet.js) did not handle the window. So it is not set in panel. how to solve this problem. how to set the javascript file to panel in vb.net

please provide som solution......



Reena Jain replied to rajeshwari balu on 23-Nov-11 04:33 AM
Hi,

To some extent it depends on what you mean by "call a javascript application".  You can certainly run a copy of cscript,exe or wscript,.exe to host your javascript code.  But that will run as a completely separate process which may not be what you want.

 

Something like this should do it...


  Process.Start(@"C:\windows\system32\wscript.exe", @"c:\myscript.js");


public void setPage(mshtml.HTMLWindow2Class JSFile) {
      window = JSFile;
}
public void scriptPrint(){
      window.execScript("report_back('Printing complete!')", "JScript");
}


It works perfectly and without ASP.NET!
rajeshwari balu replied to Reena Jain on 23-Nov-11 04:51 AM


Javascript file(testtelnet.js) opened  but it is not correctly set in to panel. The window is not handled properly. so wht to do pl give som solution