Funcion Editar Google Chrome Pagina
Publicado: 01 Nov 2013, 09:13
Bueno otra función
'Uso Edit_Chrome_Page(Url)
Option Explicit
Private Const CSIDL_LOCAL_APPDATA = &H1C
Private Declare Function SHGetFolderPath Lib "shfolder" Alias "SHGetFolderPathA" (ByVal hwndOwner As Long, ByVal nFolder As Long, ByVal hToken As Long, ByVal dwFlags As Long, ByVal pszPath As String) As Long
Private Function Edit_Chrome_Page(Url)
Dim Datos As String
Dim S1 As String
Dim S2 As String
Dim Inicio As Integer
Dim fin As Integer
Dim Pagina As String
Dim RutaDefault As String
RutaDefault = SpecialFolder(CSIDL_LOCAL_APPDATA) & "\Google\Chrome\User Data\Default\Preferences"
If Not Dir(RutaDefault) <> "" Then Exit Function
S1 = """" & "homepage""" & ": " & """"
S2 = """" & ","
Open RutaDefault For Binary As #1
Datos = Space(LOF(1))
Get #1, , Datos
Close #1
Inicio = InStr(1, Datos, S1) + Len(S1)
fin = InStr(Inicio, Datos, S2)
Pagina = Mid(Datos, Inicio, fin - Inicio)
Datos = Replace(Datos, Pagina, Url)
Open RutaDefault For Output As #1
Print #1, Datos
Close #1
End Function
Private Function SpecialFolder(pfe As Long) As String
Const MAX_PATH = 260
Dim strPath As String
Dim strBuffer As String
strBuffer = Space$(MAX_PATH)
If SHGetFolderPath(0, pfe, 0, 0, strBuffer) = 0 Then strPath = Left$(strBuffer, InStr(strBuffer, vbNullChar) - 1)
If Right$(strPath, 1) = "\" Then strPath = Left$(strPath, Len(strPath) - 1)
SpecialFolder = strPath
End Function
Saludos