WN

WN (https://www.wn.se/forum/index.php)
-   Serversidans teknologier (https://www.wn.se/forum/forumdisplay.php?f=4)
-   -   ändra startsida med vb (https://www.wn.se/forum/showthread.php?t=20336)

WaZoR.se 2007-03-31 00:30

Hej jag unrar om det är någon som kan något script som man kan ändra startsida i IE med, ska funka till Microsoft Visual Basic 2005 Express Edition... Hittade en grej på nätet men de ville inte funka, "CheckRegistryKey" blir bara blått understrycket <_<


Kod:

Sub Form_Load()
  SetIEStartPage "http://www.hemsida.se"
End Sub

Public Sub SetIEStartPage(ByVal sPage As String) ...
Public Sub SetIEStartPage(ByVal sPage As String)
  Const HKEY_CURRENT_USER = &H80000001
  Dim sKey As String
 
  sKey = "Software\Microsoft\Internet Explorer\Main"
 
  ' om nyckeln inte finns
  If CheckRegistryKey(HKEY_CURRENT_USER, sKey) = False Then
    ' skapa nyckeln
    CreateRegistryKey HKEY_CURRENT_USER, sKey
  End If
 
  ' sätter värdet
  SetRegistryValue HKEY_CURRENT_USER, sKey, "Start Page", sPage
 
End Sub


WaZoR.se 2007-03-31 01:39

Har löst det... Kanske inte det enklaste men men.

Citat:



Dim väg As String = "C:\WINDOWS\system\home.vbs"

Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click

Dim objFileSystem, objOutputFile
objFileSystem = CreateObject("Scripting.fileSystemObject")
objOutputFile = objFileSystem.CreateTextFile(väg, True)
objOutputFile.WriteLine("Dim Shell")
objOutputFile.WriteLine("Set Shell = WScript.CreateObject(""WScript.Shell"")")
objOutputFile.WriteLine("Set oIE = CreateObject(""InternetExplorer.Application"")")
objOutputFile.WriteLine("")
objOutputFile.WriteLine("Shell.RegWrite ""HKCU\Software\Microsoft\Internet Explorer\Main\Start Page"", """ & homepage.Text & """")
objOutputFile.WriteLine("")
objOutputFile.WriteLine("oIE.navigate Shell.RegRead(""HKCU\Software\Microsoft\Internet Explorer\Main\Start Page"")")
objOutputFile.WriteLine("oIE.visible=1")
objOutputFile.close()

Dim WSHShell
WSHShell = CreateObject("WScript.shell")
WSHShell.Run(väg)

End Sub




Alla tider är GMT +2. Klockan är nu 08:15.

Programvara från: vBulletin® Version 3.8.2
Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Svensk översättning av: Anders Pettersson