Autor Tema: VB6 chrome webbrowser control  (Leído 9415 veces)

0 Usuarios y 1 Visitante están viendo este tema.

NsTeam

  • Kilobyte
  • **
  • Mensajes: 54
  • Reputación: +1/-2
    • Ver Perfil
VB6 chrome webbrowser control
« en: Enero 28, 2015, 05:11:27 pm »
Buenas!

Hay alguna forma o manera de integrar Chrome a Visual Basic?.

En vez de un WebBrowser, usar un componente de Chrome...

¿Habrá forma alguna?

NsTeam

  • Kilobyte
  • **
  • Mensajes: 54
  • Reputación: +1/-2
    • Ver Perfil
Re:VB6 chrome webbrowser control
« Respuesta #1 en: Enero 30, 2015, 04:03:43 pm »
Si es que no se puede mediante un WebBrowser, quizá sea posible abrir el mismo Chrome dentro de un formulario, algo así



Cuando muevas el formulario, el navegador que está en el form, se mueva con éste.

No sé si me dejo entender, es posible?

Hugo

  • Visitante
Re:VB6 chrome webbrowser control
« Respuesta #2 en: Enero 30, 2015, 05:04:00 pm »
Hola NsTeam,

En algún momento, ví que era posible llamar una DLL, desde VB6, para manipular el ObjetoBrowser de Chrome...
El tema es, que no recuerdo donde lo ví...

Si se puede, tiene que ser, invocando una DLL (no creo que sea un OCX) que viene con la instalación de Chrome...
O bajando alguna DLL que sea para navegar, sin interfaz gráfica, por ejemplo (http://phantomjs.org/)...

Es cuestion de buscar, con distintos terminos de búsqueda, inclusive en distintos idiomas...
(porque quizás lo que buscas, está en chino)

Si lo descubrís, por favor, copialo aquí...

Un saludo,
Hugo




NsTeam

  • Kilobyte
  • **
  • Mensajes: 54
  • Reputación: +1/-2
    • Ver Perfil
Re:VB6 chrome webbrowser control
« Respuesta #3 en: Enero 30, 2015, 10:27:48 pm »
Gracias por tu respuesta, trataré de buscar lo que me dijiste...

Si alguien más podría ayudarme con esto, le estaría muy agradecido.

Hola NsTeam,

En algún momento, ví que era posible llamar una DLL, desde VB6, para manipular el ObjetoBrowser de Chrome...
El tema es, que no recuerdo donde lo ví...

Si se puede, tiene que ser, invocando una DLL (no creo que sea un OCX) que viene con la instalación de Chrome...
O bajando alguna DLL que sea para navegar, sin interfaz gráfica, por ejemplo (http://phantomjs.org/)...

Es cuestion de buscar, con distintos terminos de búsqueda, inclusive en distintos idiomas...
(porque quizás lo que buscas, está en chino)

Si lo descubrís, por favor, copialo aquí...

Un saludo,
Hugo

ssccaann43

  • Terabyte
  • *****
  • Mensajes: 970
  • Reputación: +97/-58
    • Ver Perfil
    • Sistemas Nuñez, Consultores y Soporte, C.A.
Re:VB6 chrome webbrowser control
« Respuesta #4 en: Enero 31, 2015, 11:46:42 am »
En recursosvisualbasic.com.ar nuestra antigua casa, hay un post de como insertar un ejecutable en un objeto Picture que se encuentra dentro de un form, quizás puedas darle un vistazo y eso solucione lo que tu requieres.....
Miguel Núñez.

NsTeam

  • Kilobyte
  • **
  • Mensajes: 54
  • Reputación: +1/-2
    • Ver Perfil
Re:VB6 chrome webbrowser control
« Respuesta #5 en: Enero 31, 2015, 12:43:42 pm »
En recursosvisualbasic.com.ar nuestra antigua casa, hay un post de como insertar un ejecutable en un objeto Picture que se encuentra dentro de un form, quizás puedas darle un vistazo y eso solucione lo que tu requieres.....

Muchas gracias por tu respuesta ssccaann43, efectivamente encontré una artículo interesante usando el Api SetParent en recursosvisualbasic que fue este:

http://www.recursosvisualbasic.com.ar/htm/listado-api/152-incrustar-programa-en-picturebox.htm

He buscado más información en Google, en páginas en inglés y tengo este código.

Código: (VB) [Seleccionar]
Option Explicit

Private Declare Function GetGUIThreadInfo Lib "user32.dll" ( _
                 ByVal idThread As Long, _
                 ByRef pgui As GUITHREADINFO) As Long
                 
Private Declare Function SetParent Lib "user32" _
                (ByVal hWndChild As Long, _
                 ByVal hWndNewParent As Long) As Long

Private Declare Function GetAncestor Lib "user32.dll" _
                (ByVal hwnd As Long, _
                 ByVal gaFlags As Long) As Long
                 
Private Declare Function CreateProcess Lib "kernel32" Alias "CreateProcessA" _
                (ByVal lpApplicationName As String, _
                 ByVal lpCommandLine As String, _
                 lpProcessAttributes As SECURITY_ATTRIBUTES, _
                 lpThreadAttributes As SECURITY_ATTRIBUTES, _
                 ByVal bInheritHandles As Boolean, _
                 ByVal dwCreationFlags As Long, _
                 lpEnvironment As Any, ByVal _
                 lpCurrentDriectory As String, _
                 lpStartupInfo As STARTUPINFO, _
                 lpProcessInformation As PROCESS_INFORMATION) As Long
                 
Private Declare Function SetWindowPos Lib "user32" _
                (ByVal hwnd As Long, _
                 ByVal hWndInsertAfter As Long, _
                 ByVal x As Long, _
                 ByVal y As Long, _
                 ByVal cx As Long, _
                 ByVal cy As Long, _
                 ByVal wFlags As Long) As Long

Private Type RECT
        Left As Long
        Top As Long
        Right As Long
        Bottom As Long
End Type

Private Type GUITHREADINFO
        cbSize As Long
        flags As Long
        hwndactive As Long
        hwndFocus As Long
        hwndCapture As Long
        hwndMenuOwner As Long
        hwndMoveSize As Long
        hwndcaret As Long
        rcCaret As RECT
End Type
Private Type STARTUPINFO
        cb As Long
        lpReserved As String
        lpDesktop As String
        lpTitle As String
        dwX As Long
        dwY As Long
        dwXSize As Long
        dwYSize As Long
        dwXCountChars As Long
        dwYCountChars As Long
        dwFillAttribute As Long
        dwFlags As Long
        wShowWindow As Integer
        cbReserved2 As Integer
        lpReserved2 As Long
        hStdInput As Long
        hStdOutput As Long
        hStdError As Long
End Type

Private Type PROCESS_INFORMATION
        hProcess As Long
        hThread As Long
        dwProcessId As Long
        dwThreadId As Long
End Type

Private Type SECURITY_ATTRIBUTES
        nLength As Long
        lpSecurityDescriptor As Long
        bInheritHandle As Boolean
End Type

Private Const GA_PARENT = 1
Private Const SWP_NOOWNERZORDER = &H200
Private Const SWP_NOZORDER = &H4
Private Const SWP_SHOWWINDOW = &H40

Private udtGUI As GUITHREADINFO
Private udtProc As PROCESS_INFORMATION

Private Function StartProcess(strProgram As String) As Long
Dim udtStartup As STARTUPINFO
Dim udtSec As SECURITY_ATTRIBUTES
Dim lngReturn As Long
udtStartup.cb = Len(udtStartup)
udtSec.nLength = Len(udtSec)
udtSec.bInheritHandle = True
'
' Start the process
'
lngReturn = CreateProcess(strProgram, vbNullString, udtSec, udtSec, _
                         True, ByVal 0, ByVal 0, vbNullString, _
                         udtStartup, _
                         udtProc)
txtProcess.Text = Hex(udtProc.dwThreadId)
lngReturn = GetAncestor(udtProc.hProcess, GA_PARENT)
txtParent.Text = Hex(lngReturn)
udtGUI.cbSize = Len(udtGUI)
'
' Wait for an hWnd to be allocated
'
Do
    lngReturn = GetGUIThreadInfo(udtProc.dwThreadId, udtGUI)
    DoEvents
Loop Until udtGUI.hwndactive <> 0
StartProcess = udtGUI.hwndactive
End Function
Private Sub PositionWindow(hwnd As Long)
Dim lngReturn As Long
lngReturn = SetWindowPos(hwnd, hwnd, 250&, 0&, 250&, 250&, SWP_NOZORDER Or SWP_SHOWWINDOW)
End Sub
Private Sub cmdIE_Click()
Dim lngReturn As Long
Dim strProg As String
strProg = "C:\Program Files (x86)\FileZilla FTP Client\filezilla.exe"
lngReturn = StartProcess(strProg)
End Sub


Private Sub Command1_Click()
'
' Change the Parent
'
Dim lngReturn As Long
Dim lngStyle As Long
lngReturn = SetParent(udtGUI.hwndactive, Me.hwnd)
Call PositionWindow(udtGUI.hwndactive)
lngReturn = GetAncestor(udtGUI.hwndactive, GA_PARENT)
txtParent.Text = Hex(lngReturn)
End Sub

Private Sub Form_Load()
txtMe.Text = Hex(Me.hwnd)
'
' Scalemode = Pixel
'
Me.ScaleMode = 3
End Sub


Y efectivamente hace lo que yo quiero, abre un programa dentro del formulario, lo probé con Filezilla y Photoshop



Pero lo que no entiendo es por qué no pasa lo mismo con Chrome, me refiero a que lo abre en una nueva ventana mas no dentro del formulario
« última modificación: Enero 31, 2015, 04:36:22 pm por NsTeam »

Hugo

  • Visitante
Re:VB6 chrome webbrowser control
« Respuesta #6 en: Febrero 03, 2015, 03:38:38 am »
Hola Amigos,

Encontré el siguiente ejemplo, pero en VB.NET...
Habría que confirmar que sirve, como referencia, para VB6...

[youtube]Bo7kU5qSxtI[/youtube]


WebKit para descargar:
http://foro.tutorialeshispanos.com/VBNET/Webkitbrowser.rar


Por favor, si alguien tiene tiempo para confirmar que este ejemplo sirve para VB6...
Estaré muy agradecido...

¡Un saludo!
 ;) Hugo