Antwise community forums

Full Version: Getting hwnd of Control
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Is it possible to get the hwnd of the Edge Browser Control?
Hi,

Not at the moment. At least there's no officially supported way to do that.

Out of curiosity, can you tell me why you want to have the window handle to the browser control?

FWIW, I opened a ticket on your behalf to look into this.
--
Wil
I was trying to capture a screenshot of the control and needed it’s hwnd. I did try winspy to get its hwnd but it produced a blank image. Must be limitations of edge itself as i know capturing a canvas image of a https video is near impossible.
(2022-06-21, 19:06:41)maddire Wrote: [ -> ]I was trying to capture a screenshot of the control and needed it’s hwnd. I did try winspy to get its hwnd but it produced a blank image. Must be limitations of edge itself as i know capturing a canvas image of a https video is near impossible.

One way that at least seems to give some results is to print to Pdf.
eg. I added a button and then called this:
Code:
Private Sub PrintCurrentDocument()
  Dim FilePath As String
  Dim Settings As String
 
  FilePath = "" ' Not specifying a path+filename will popup a file save as dialog
  Settings = "" ' JSON serialized string with options for settings
  ' We're going to add the following JSON:
  ' { "displayHeaderFooter" : true,
  '   "headerTitle" : "AntView PrintToPdf Demo",
  '   "printBackground" : true,
  '   "scale" : 0.5
  ' }
  Settings = "{"
  Settings = Settings & " ""displayHeaderFooter"": true, "
  Settings = Settings & " ""headerTitle"": ""AntView PrintToPdf Demo"", "
  Settings = Settings & " ""printBackground"": true, "
  Settings = Settings & " ""scale"": 0.5 "
  Settings = Settings & "}"
  EdgeWebBrowser.PrintToPdf FilePath, Settings
End Sub
and that did print the contents of the video in the Pdf.

Not sure if that helps you though.
--
Wil