#Region Project Attributes
#MainFormWidth: 600
#MainFormHeight: 600
#End Region
' https://faq.whatsapp.com/en/general/26000030
Sub Process_Globals
Private fx As JFX
Private MainForm As Form
Private link As String = "https://wa.me/$Phone?text=$Text"
Private Button1 As Button
Private TextField1 As TextField
Private TextField2 As TextField
Private WebView1 As WebView
Private Button2 As Button
Private Button3 As Button
End Sub
Sub AppStart (Form1 As Form, Args() As String)
MainForm = Form1
MainForm.RootPane.LoadLayout("Layout1") 'Load the layout file.
MainForm.Show
Jweb(WebView1,"https://web.whatsapp.com/")
End Sub
'Return true to allow the default exceptions handler to handle the uncaught exception.
Sub Application_Error (Error As Exception, StackTrace As String) As Boolean
Return True
End Sub
Sub Button1_Click
link = link.Replace("$Phone",TextField1.Text).Replace("$Text",TextField2.Text)
Jweb(WebView1,link)
End Sub
Sub Button3_Click
Jweb(WebView1,"http://www.enre.it/")
End Sub
Sub Button2_Click
Jweb(WebView1,"https://web.whatsapp.com/")
End Sub
Sub Jweb(wv As WebView, url As String)
Dim jo As JavaObject = wv
jo = jo.RunMethod("getEngine", Null)
jo.RunMethod("setUserAgent", Array("Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/66.0.3359.181 Safari/537.36"))
'check:
wv.LoadUrl(url)
End Sub