I am new to vb 6.0.
I have to open any browser other than Internet Explorer in the web browser control of vb (which open IE by default)
I have tried many codes and I can now open browser as if it is new window (by using process.start etc)
Is there any way to open it in existing vb control?
The web browser control IS Internet Explorer. So unless chrome et al release a ActiveX control of their browser, which they haven't, it is not possible.
There is a workaround is that you start chrome and then hook it's CreateWindowsEx and put your Apps Window as the owner. Then size it where you would have the web browser control using SetWindowPos
. This gives the following features
An owned window is always above its owner in the Z order.
The system automatically destroys an owned window when its owner is destroyed.
An owned window is hidden when its owner is minimized.
Private Sub Command1_Click()
sAppName = "Google Chorme"
sAppPath = "C:\Users\082043\AppData\Local\Google\Chrome\Application\chrome.exe"
Shell sAppPath, vbMinimizedFocus
End Sub
'You could try the following code to invoke the default browser (applies to VB 6)
'Place this at very top, but below the 'Option' declarations
Private Declare Function ShellExecute Lib "shell32.dll" Alias "ShellExecuteA" (ByVal hwnd As Long, ByVal lpOperation As String, ByVal lpFile As String, ByVal lpParameters As String, ByVal lpDirectory As String, ByVal nShowCmd As Long) As Long
'Place this where 'Sub' are placed' This invokes the default browser to go to google.com.
Private Sub cmdBUTTON_Click()
ShellExecute 0&, vbNullString, "http://www.google.com", vbNullString, vbNullString, 10
End Sub
'You could find information on the variables here
'https://msdn.microsoft.com/en-us/library/windows/desktop/bb762153(v=vs.85).aspx