Module StealRS2
Private Declare Auto Function FindWindowEx Lib "user32" (ByVal parentHandle As IntPtr, _
ByVal childAfter As IntPtr, _
ByVal lclassName As String, _
ByVal windowTitle As String) As IntPtr
Private Declare Auto Function SetParent Lib "user32" (ByVal hWndChild As IntPtr, _
ByVal hWndNewParent As IntPtr) As IntPtr
Declare Auto Function SetWindowPos Lib "user32" (ByVal hWnd As IntPtr, _
ByVal hWndInsertAfter As IntPtr, _
ByVal X As Integer, _
ByVal Y As Integer, _
ByVal cx As Integer, _
ByVal cy As Integer, _
ByVal uFlags As UInteger) As Boolean
Sub Steal(ByVal FormHandle As IntPtr, ByVal WBHandle As IntPtr)
On Error Resume Next
Dim RSHwnd As IntPtr, RSSunJava As IntPtr, RSSunJava6 As IntPtr
RSHwnd = FindWindowEx(WBHandle, 0&, "shell embedding", "")
RSHwnd = FindWindowEx(RSHwnd, 0&, "shell docobject view", "")
RSHwnd = FindWindowEx(RSHwnd, 0&, "internet explorer_server", "")
RSSunJava = FindWindowEx(RSHwnd, 0&, "Java Plug-in Control Window", "")
RSSunJava6 = FindWindowEx(RSSunJava, 0&, "SunAwtFrame", "")
RSSunJava = FindWindowEx(RSSunJava, 0&, "sun.plugin.viewer.frame.IExplorerEmbeddedFrame", "")
RSHwnd = FindWindowEx(RSHwnd, 0&, "microsoft vm for java(tm) host window class", "")
RSHwnd = FindWindowEx(RSHwnd, 0&, "msawt_comp_class", "")
If (RSSunJava = 0) Then RSSunJava = RSSunJava6
If (RSHwnd = 0) Then RSHwnd = RSSunJava
If (RSHwnd = 0) Then Exit Sub
SetParent(RSHwnd, FormHandle)
SetWindowPos(RSHwnd, New IntPtr(0), 0, 0, 0, 0, &H200 Or &H1)
End Sub
End Module