Responses to queries

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I am developing an application in VB6 that among other things it queries a
remote server. In the url I set up a target window. When the response
arrives it doesn't connect to the browser. The window appears by itself.
What I need is to be able to connect the response to my browser in order to
process the response.

Thanks for your help.
 
Depends on how you are launching the URL.
ShellExecute will create a new instance of IE and display the response in
the main window.

In VB6 you need to create a new instance of Internet Explorer or if there is
an existing instance you need to hook into it.
Public WithEvents myWB As WebBrowser (form declarations)

Then with the form load (pseudocode used here)

GetTopIE ' Get the hwnd of the top IE window and hook it to MyWB
If Not myWB Is Nothing Then
IEhwnd = myWB.hwnd
Else ' No existing IE so create it
Set myWB = New InternetExplorer
With myWB
.Navigate2 "about:blank"
.Visible = True
r = ShowWindow(myWB.hwnd, 1)
' You need to hide the MSN Search bar with tabbed browsing as it has
multiple IE hooks
.ShowBrowserBar "{BDAD1DAD-C946-4A17-ADC1-64B5B4FF55D0}", False
IEhwnd = myWB.hwnd
End With
End If


Then say you want to navigate to a SearchURL

surl = http://search.com?s=my search string
myWB.Navigate2 surl,,"_main"


'' You see the third argument of the Navigate2 method is the target frame.
Use "_blank" to open in a new window, "_top" or "_main" to open in the
current browser main window, "_search" to open in the Search explorer bar or
"_media" to open in the Media explorer bar.

If you are programming for the MSNSearch tabbed browsing interface then you
can even open the link in a new tab.
Hint - have a look at the context menu for "Open in new foreground tab" .
Use either msntb: or msntabb: or msntabf: protocol.

Heres the replacement script to open a url in a new tab from the context
menu.

var URL;
if ("A" == external.menuArguments.event.srcElement.parentElement.tagName)
{
URL =
external.menuArguments.event.srcElement.parentElement.getAttribute("href");
}
else
URL = external.menuArguments.event.srcElement.href;
if( URL.substring( 0,5 ) == "http:"
|| URL.substring( 0,6 ) == "https:"
|| URL.substring( 0,4 ) == "ftp:"
|| URL.substring( 0,6 ) == "about:" )
{
URL = "msntabb://c3e540ff3ea34d0da22e74335112917" + URL;
external.menuArguments.document.location.href = URL;
}
else
external.menuArguments.event.srcElement.click();
 
Thanks Rob
--
Grandpa Jack the Byte Doc


Rob Parsons said:
Depends on how you are launching the URL.
ShellExecute will create a new instance of IE and display the response in
the main window.

In VB6 you need to create a new instance of Internet Explorer or if there is
an existing instance you need to hook into it.
Public WithEvents myWB As WebBrowser (form declarations)

Then with the form load (pseudocode used here)

GetTopIE ' Get the hwnd of the top IE window and hook it to MyWB
If Not myWB Is Nothing Then
IEhwnd = myWB.hwnd
Else ' No existing IE so create it
Set myWB = New InternetExplorer
With myWB
.Navigate2 "about:blank"
.Visible = True
r = ShowWindow(myWB.hwnd, 1)
' You need to hide the MSN Search bar with tabbed browsing as it has
multiple IE hooks
.ShowBrowserBar "{BDAD1DAD-C946-4A17-ADC1-64B5B4FF55D0}", False
IEhwnd = myWB.hwnd
End With
End If


Then say you want to navigate to a SearchURL

surl = http://search.com?s=my search string
myWB.Navigate2 surl,,"_main"


'' You see the third argument of the Navigate2 method is the target frame.
Use "_blank" to open in a new window, "_top" or "_main" to open in the
current browser main window, "_search" to open in the Search explorer bar or
"_media" to open in the Media explorer bar.

If you are programming for the MSNSearch tabbed browsing interface then you
can even open the link in a new tab.
Hint - have a look at the context menu for "Open in new foreground tab" .
Use either msntb: or msntabb: or msntabf: protocol.

Heres the replacement script to open a url in a new tab from the context
menu.

var URL;
if ("A" == external.menuArguments.event.srcElement.parentElement.tagName)
{
URL =
external.menuArguments.event.srcElement.parentElement.getAttribute("href");
}
else
URL = external.menuArguments.event.srcElement.href;
if( URL.substring( 0,5 ) == "http:"
|| URL.substring( 0,6 ) == "https:"
|| URL.substring( 0,4 ) == "ftp:"
|| URL.substring( 0,6 ) == "about:" )
{
URL = "msntabb://c3e540ff3ea34d0da22e74335112917" + URL;
external.menuArguments.document.location.href = URL;
}
else
external.menuArguments.event.srcElement.click();
 
Back
Top