Foros del Web » Programación para mayores de 30 ;) » Programación General »

VB6.Ejecutar Iexplore.exe desde la app

Estas en el tema de VB6.Ejecutar Iexplore.exe desde la app en el foro de Programación General en Foros del Web. Hola a tod@s!!! Les expongo mi problema: Desde mi aplicación tengo que abrir el internet explorer con una URL determinada. Bien, usando el comando Shell ...
  #1 (permalink)  
Antiguo 16/06/2004, 13:28
Avatar de GeRuNdIo  
Fecha de Ingreso: marzo-2004
Ubicación: Sanlúcar de Barrameda, Cádiz
Mensajes: 232
Antigüedad: 20 años, 1 mes
Puntos: 2
VB6.Ejecutar Iexplore.exe desde la app

Hola a tod@s!!!
Les expongo mi problema:
Desde mi aplicación tengo que abrir el internet explorer con una URL determinada. Bien, usando el comando Shell "pathname", parametros lo consigo sin problemas.
Mi problema consiste en que la aplicación a la que me refiero, debe poder correr bajo diferentes sistemas operativos, y es ahí donde encuentro mi problema. El "pathname" del comando Shell es diferente según el sistema operativo. En Windows XP, por ejemplo, es: "C:/Archivos de Programa/Internet Explorer/iexplore.exe", en Windows 95.... a saber....
Aqui tengo un gran problema para el desarrollo de mi proyecto, ya que uno de los requisitos fundamentales es la portabilidad de la aplicación. Debe funcionar perfectamente en sistemas windows desde el W95 hasta el WXP.

He probado a poner una ruta relativa: Shell "iexplore.exe", vbMaximizedFocus
y nada, no funciona, no se ejecuta la aplicación.....


Al principio, utilicé el componente webbrowser en un form como navegador, pero no me funcionó debido a que este componente no implementa el uso de cookies, o al menos eso creo.... (la web que tengo que abrir necesita de las cookies para abrirse correctamente).

Espero me puedan ayudar con este GRAN problema, tengo la entrega del proyecto el lunes 21 .....

PD.:Se aceptan todo tipo de soluciones, alternativas o lo que sea....

SaLuDoS
y
G R A C I A S ! ! ! !
__________________
Una buena forma de sacar las castañas del fuego sin quemarse: LEE FOROSDELWEB..... :si:
------
F.P.R. MCAD .NET
  #2 (permalink)  
Antiguo 16/06/2004, 15:56
Avatar de Eternal Idol  
Fecha de Ingreso: mayo-2004
Ubicación: Lucentum
Mensajes: 6.192
Antigüedad: 19 años, 11 meses
Puntos: 74
En Windows XP, por ejemplo, es: "C:/Archivos de Programa/Internet Explorer/iexplore.exe", en Windows 95.... a saber.... << esto es bastante erroneo, Windows crea \Archivos de Programa\ o \Program Files\ según el idioma en que este instalado para empezar.

Lo que podes hacer es un ShellExecute() de la url o sino otra alternativa es buscar el archivo iexplore.exe.

En el registro del sistema esta:

HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\Curr entVersion\App Paths\Iexplore.exe y la clave path
__________________
¡Peron cumple, Evita dignifica! VIVA PERON CARAJO

Última edición por Eternal Idol; 16/06/2004 a las 15:57
  #3 (permalink)  
Antiguo 16/06/2004, 16:25
Avatar de GeRuNdIo  
Fecha de Ingreso: marzo-2004
Ubicación: Sanlúcar de Barrameda, Cádiz
Mensajes: 232
Antigüedad: 20 años, 1 mes
Puntos: 2
Cita:
buscar el archivo iexplore.exe.

En el registro del sistema esta:

HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\Curr entVersion\App Paths\Iexplore.exe y la clave path
Hola!!
Gracias por responder ante todo.
Esta idea ya la habia pensado, pero no sé como hacer la búsqueda....
Me podrías pastear algo de código para saber como hacerlo??
De nuevo mil gracias!!
__________________
Una buena forma de sacar las castañas del fuego sin quemarse: LEE FOROSDELWEB..... :si:
------
F.P.R. MCAD .NET
  #4 (permalink)  
Antiguo 17/06/2004, 00:46
Avatar de Eternal Idol  
Fecha de Ingreso: mayo-2004
Ubicación: Lucentum
Mensajes: 6.192
Antigüedad: 19 años, 11 meses
Puntos: 74
http://www.allapi.net/ bajate el API-Guide, ahi hay muchos ejemplos de la API de Windows, yo ya no programo en VB así que acá va un ej. de ellos:

'This program needs 3 buttons
Const REG_SZ = 1 ' Unicode nul terminated string
Const REG_BINARY = 3 ' Free form binary
Const HKEY_CURRENT_USER = &H80000001
Private Declare Function RegCloseKey Lib "advapi32.dll" (ByVal hKey As Long) As Long
Private Declare Function RegCreateKey Lib "advapi32.dll" Alias "RegCreateKeyA" (ByVal hKey As Long, ByVal lpSubKey As String, phkResult As Long) As Long
Private Declare Function RegDeleteValue Lib "advapi32.dll" Alias "RegDeleteValueA" (ByVal hKey As Long, ByVal lpValueName As String) As Long
Private Declare Function RegOpenKey Lib "advapi32.dll" Alias "RegOpenKeyA" (ByVal hKey As Long, ByVal lpSubKey As String, phkResult As Long) As Long
Private Declare Function RegQueryValueEx Lib "advapi32.dll" Alias "RegQueryValueExA" (ByVal hKey As Long, ByVal lpValueName As String, ByVal lpReserved As Long, lpType As Long, lpData As Any, lpcbData As Long) As Long
Private Declare Function RegSetValueEx Lib "advapi32.dll" Alias "RegSetValueExA" (ByVal hKey As Long, ByVal lpValueName As String, ByVal Reserved As Long, ByVal dwType As Long, lpData As Any, ByVal cbData As Long) As Long
Function RegQueryStringValue(ByVal hKey As Long, ByVal strValueName As String) As String
Dim lResult As Long, lValueType As Long, strBuf As String, lDataBufSize As Long
'retrieve nformation about the key
lResult = RegQueryValueEx(hKey, strValueName, 0, lValueType, ByVal 0, lDataBufSize)
If lResult = 0 Then
If lValueType = REG_SZ Then
'Create a buffer
strBuf = String(lDataBufSize, Chr$(0))
'retrieve the key's content
lResult = RegQueryValueEx(hKey, strValueName, 0, 0, ByVal strBuf, lDataBufSize)
If lResult = 0 Then
'Remove the unnecessary chr$(0)'s
RegQueryStringValue = Left$(strBuf, InStr(1, strBuf, Chr$(0)) - 1)
End If
ElseIf lValueType = REG_BINARY Then
Dim strData As Integer
'retrieve the key's value
lResult = RegQueryValueEx(hKey, strValueName, 0, 0, strData, lDataBufSize)
If lResult = 0 Then
RegQueryStringValue = strData
End If
End If
End If
End Function
Function GetString(hKey As Long, strPath As String, strValue As String)
Dim Ret
'Open the key
RegOpenKey hKey, strPath, Ret
'Get the key's content
GetString = RegQueryStringValue(Ret, strValue)
'Close the key
RegCloseKey Ret
End Function
Sub SaveString(hKey As Long, strPath As String, strValue As String, strData As String)
Dim Ret
'Create a new key
RegCreateKey hKey, strPath, Ret
'Save a string to the key
RegSetValueEx Ret, strValue, 0, REG_SZ, ByVal strData, Len(strData)
'close the key
RegCloseKey Ret
End Sub
Sub SaveStringLong(hKey As Long, strPath As String, strValue As String, strData As String)
Dim Ret
'Create a new key
RegCreateKey hKey, strPath, Ret
'Set the key's value
RegSetValueEx Ret, strValue, 0, REG_BINARY, CByte(strData), 4
'close the key
RegCloseKey Ret
End Sub
Sub DelSetting(hKey As Long, strPath As String, strValue As String)
Dim Ret
'Create a new key
RegCreateKey hKey, strPath, Ret
'Delete the key's value
RegDeleteValue Ret, strValue
'close the key
RegCloseKey Ret
End Sub
Private Sub Command1_Click()
Dim strString As String
'Ask for a value
strString = InputBox("Please enter a value between 0 and 255 to be saved as a binary value in the registry.", App.Title)
If strString = "" Or Val(strString) > 255 Or Val(strString) < 0 Then
MsgBox "Invalid value entered ...", vbExclamation + vbOKOnly, App.Title
Exit Sub
End If
'Save the value to the registry
SaveStringLong HKEY_CURRENT_USER, "KPD-Team", "BinaryValue", CByte(strString)
End Sub
Private Sub Command2_Click()
'Get a string from the registry
Ret = GetString(HKEY_CURRENT_USER, "KPD-Team", "BinaryValue")
If Ret = "" Then MsgBox "No value found !", vbExclamation + vbOKOnly, App.Title: Exit Sub
MsgBox "The value is " + Ret, vbOKOnly + vbInformation, App.Title
End Sub
Private Sub Command3_Click()
'Delete the setting from the registry
DelSetting HKEY_CURRENT_USER, "KPD-Team", "BinaryValue"
MsgBox "The value was deleted ...", vbInformation + vbOKOnly, App.Title
End Sub
Private Sub Form_Load()
'KPD-Team 1998
'URL: http://www.allapi.net/
'E-Mail: [email protected]
Command1.Caption = "Set Value"
Command2.Caption = "Get Value"
Command3.Caption = "Delete Value"
End Sub
__________________
¡Peron cumple, Evita dignifica! VIVA PERON CARAJO
  #5 (permalink)  
Antiguo 17/06/2004, 03:13
Avatar de GeRuNdIo  
Fecha de Ingreso: marzo-2004
Ubicación: Sanlúcar de Barrameda, Cádiz
Mensajes: 232
Antigüedad: 20 años, 1 mes
Puntos: 2
Muchas gracias Eternal, encontre otra solución más rápida:

Dim objShell As New WshShell
Dim strkey As String
Dim path As String

strkey = "HKEY_CLASSES_ROOT\htmlfile\shell\open\command \"
path = objShell.RegRead(strkey)


Para que funciones tenemos que agregar la referencia Windows Script Host Object Model

Muchas gracias otra vez por el interes prestado!
:saludos:
__________________
Una buena forma de sacar las castañas del fuego sin quemarse: LEE FOROSDELWEB..... :si:
------
F.P.R. MCAD .NET
  #6 (permalink)  
Antiguo 17/06/2004, 03:19
Avatar de Eternal Idol  
Fecha de Ingreso: mayo-2004
Ubicación: Lucentum
Mensajes: 6.192
Antigüedad: 19 años, 11 meses
Puntos: 74
Dudo de que sea más rápida, será más corta que es diferente. Ese código te encapsula todo lo que deberías saber sobre el registro del sistema, pero bueno cada uno programa como quiere. Yo siempre prefiero hacerlo todo por mi mismo (dentro de lo que se puede claro).
__________________
¡Peron cumple, Evita dignifica! VIVA PERON CARAJO
Atención: Estás leyendo un tema que no tiene actividad desde hace más de 6 MESES, te recomendamos abrir un Nuevo tema en lugar de responder al actual.
Respuesta




La zona horaria es GMT -6. Ahora son las 15:45.