How to capture IE inner content ?

Add-in Express™ Support Service
That's what is more important than anything else

How to capture IE inner content ?
Raphael Stuyck

Posts: 2
Joined: 2010-03-17
I'm using a sideBar
I want to capture the content of the browser as image (only the website, no bar, no menu, nothing)
I've a code using Screen.PrimaryScreen
As I'm newbie, could you help ?

the function works fine, but takes a capture from the whole screen, and I just want the inner content from the active tab
In red, what I need to change
I already read all your forum and doc but it doesn't help me...


Private Sub grabscreen(ByVal myId As String)
Dim bounds As Rectangle
Dim Screenshot As System.Drawing.Bitmap
Dim graph As Graphics
bounds = Screen.PrimaryScreen.Bounds

Screenshot = New System.Drawing.Bitmap(bounds.Width, bounds.Height, System.Drawing.Imaging.PixelFormat.Format32bppArgb)
graph = Graphics.FromImage(Screenshot)
graph.CopyFromScreen(bounds.X, bounds.Y, 0, 0, bounds.Size, CopyPixelOperation.SourceCopy)

PictureBox1.Image = Screenshot

Dim tmpFilePath As String = String.Empty
If Me.pAPI IsNot Nothing Then
tmpFilePath = Me.pAPI.GetWriteableFolderPath()
PictureBox1.Image.Save(tmpFilePath & "\" & myId & ".bmp", System.Drawing.Imaging.ImageFormat.Bmp)
End If
Catch err As Exception
If tmpFilePath <> String.Empty Then
If File.Exists(tmpFilePath) Then
End If
End If
End Try

End Sub
Posted 17 Mar, 2010 19:53:31 Top
Andrei Smolin

Add-in Express team

Posts: 14370
Joined: 2006-05-11
Hi Raphael,

You can try using GetWindowRect (its a Win32 API function) to get the rectangle. Try using ADXIEModule.MainWindowHandle or ADXIEModule.ParentWindowHandle and pass the corresponding hwnd to that function.

Regards from Belarus (GMT+2),

Andrei Smolin
Add-in Express Team Leader
Posted 18 Mar, 2010 06:09:41 Top