Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
VB6: How to create an Antview control dynamically?
#2
Hello AlKalm,

We just tested it here for the AntView2 control and the following code worked for us.
Code:
Public WithEvents EdgeBrowser As AntviewAx2.Antview

Private Sub Form_Initialize()
  Dim Err As Boolean
  Dim ErrStat As AntviewAx2.TxWebErrorStatus
 
  Set EdgeBrowser = Controls.Add("AntViewAx2.Antview", "EdgeBrowser")
  EdgeBrowser.Top = 300
  EdgeBrowser.Left = 200
  EdgeBrowser.Height = 4000
  EdgeBrowser.Width = 10000
  EdgeBrowser.EventsUseHexadecimal = True
  EdgeBrowser.Visible = True
  EdgeBrowser.CreateWebView
  EdgeBrowser.UnlockControl "ExampleCompany", "WI5PO2-2KSU3Q-HWFXFU-IUMU2V-QF8P2F"
  EdgeBrowser.Navigate "https://www.microsoft.com"
' navigatesync does not work when you create the control like above
'  EdgeBrowser.NavigateSync "https://www.microsoft.com", Err, ErrStat
End Sub

Please be aware that in the case you installed AntView version 1.1 that the code needs to look a little bit different.

Code:
Public WithEvents EdgeBrowser As AntviewAx.Antview


Private Sub Form_Initialize()
  Dim Err As Boolean
  Dim ErrStat As AntviewAx.TxWebErrorStatus
 
  Set EdgeBrowser = Controls.Add("AntViewAx.Antview", "EdgeBrowser")
  EdgeBrowser.Top = 300
  EdgeBrowser.Left = 200
  EdgeBrowser.Height = 4000
  EdgeBrowser.Width = 10000
  EdgeBrowser.EventsUseHexadecimal = True
  EdgeBrowser.Visible = True
  EdgeBrowser.CreateWebView
  EdgeBrowser.UnlockControl "ExampleCompany", "WI5PO2-2KSU3Q-HWFXFU-IUMU2V-QF8P2F"
  EdgeBrowser.Navigate "https://www.microsoft.com"
' navigatesync does not work when you create the control like above
'  EdgeBrowser.NavigateSync "https://www.microsoft.com", Err, ErrStat
End Sub

We'll add an example of this to the standard examples just to make sure that it is easier to find on how-to do this.

--
Wil
Reply


Messages In This Thread
RE: VB6: How to create an Antview control dynamically? - by wila - 2024-11-12, 14:14:34

Forum Jump:


Users browsing this thread: 1 Guest(s)