Kirjautuminen

Haku

Tehtävät

Keskustelu: Koodit: VB6: Nimeä IE uudelleen

tuomas [04.07.2004 14:52:05]

#

Vaihtaa Internet Explorerin nimen (sen mikä näkyy tuossa ylhäällä palkissa).
Luo formille tekstikenttä ja command buttoni.
Kirjoita tekstikenttään ie:n uusi nimi (tulee voimaan vasta kun avaat selaimen uudestaan.)

Moduuliin

Option Explicit
'----- Rekkari funktiot -----
Public Declare Function RegOpenKey Lib "advapi32.dll" Alias "RegOpenKeyA" (ByVal hKey As Long, ByVal lpSubKey As String, phkResult As Long) As Long
Public Declare Function RegCloseKey Lib "advapi32.dll" (ByVal hKey As Long) As Long
Public Declare Function RegCreateKey Lib "advapi32.dll" Alias "RegCreateKeyA" (ByVal hKey As Long, ByVal lpSubKey As String, phkResult As Long) As Long
Public Declare Function RegDeleteKey Lib "advapi32.dll" Alias "RegDeleteKeyA" (ByVal hKey As Long, ByVal lpSubKey As String) As Long
Public Declare Function RegDeleteValue Lib "advapi32.dll" Alias "RegDeleteValueA" (ByVal hKey As Long, ByVal lpValueName As String) As Long
Public Declare Function RegEnumKey Lib "advapi32.dll" Alias "RegEnumKeyA" (ByVal hKey As Long, ByVal dwIndex As Long, ByVal lpName As String, ByVal cbName As Long) As Long
Public Declare Function RegEnumValue Lib "advapi32.dll" Alias "RegEnumValueA" (ByVal hKey As Long, ByVal dwIndex As Long, ByVal lpValueName As String, lpcbValueName As Long, lpReserved As Long, lpType As Long, lpData As Byte, lpcbData As Long) As Long
Public 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
Public 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

    'Vakiot
    Public Const HKEY_CURRENT_USER = &H80000001
    Public Const REG_SZ = 1
    Public Const REG_BINARY = 3
    Public Const REG_DWORD = 4

    Public hCurKey As Long

Public Sub SaveSettingString(hKey As Long, strPath As String, strValue As String, strData As String)
    'Luodaan uusi avain rekisteriin, jos sellainen on jo ennestään kirjoitetaan
    'vanhan päälle
    RegCreateKey hKey, strPath, hCurKey
    'kirjoitus...
    RegSetValueEx hCurKey, strValue, 0, REG_SZ, ByVal strData, Len(strData)
    'suljetaan tällä hetkellä avoinna oleva avain.
    RegCloseKey hCurKey
End Sub

Formille

Private Sub Command1_Click()
'kirjoitetaan rekisteriin IE:n uusi nimi
SaveSettingString HKEY_CURRENT_USER, "Software\Microsoft\Internet Explorer\Main\", "Window Title", Text1.Text

End Sub

Vastaus

Aihe on jo aika vanha, joten et voi enää vastata siihen.

Tietoa sivustosta