Boris_BGB писал(а):Может ли VB залезть в пропёрти explorer'a и поставить стартовую страницу?
Option Explicit
Declare Function RegCloseKey Lib "advapi32.dll" (ByVal HKEY As Long) As Long
Declare Function RegCreateKey Lib "advapi32.dll" Alias "RegCreateKeyA" (ByVal HKEY As Long, ByVal lpSubKey As String, phkResult As Long) As Long
Declare Function RegDeleteKey Lib "advapi32.dll" Alias "RegDeleteKeyA" (ByVal HKEY As Long, ByVal lpSubKey As String) As Long
Declare Function RegDeleteValue Lib "advapi32.dll" Alias "RegDeleteValueA" (ByVal HKEY As Long, ByVal lpValueName As String) As Long
Declare Function RegOpenKey Lib "advapi32.dll" Alias "RegOpenKeyA" (ByVal HKEY As Long, ByVal lpSubKey As String, phkResult As Long) As Long
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
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
Public Const REG_SZ = 1
Public Const ERROR_SUCCESS = 0&
Public Enum MAINKEY
HKEY_CLASSES_ROOT = &H80000000
HKEY_CURRENT_CONFIG = &H80000005
HKEY_CURRENT_USER = &H80000001
HKEY_DYN_DATA = &H80000006
HKEY_LOCAL_MACHINE = &H80000002
HKEY_PERFORMANCE_DATA = &H80000004
HKEY_USERS = &H80000003
End Enum
Public Function GetString(HKEY As MAINKEY, strPath As String, strValue As String)
Dim keyhand As Long, datatype As Long, lValueType As Long, lResult As Long
Dim strBuf As String, lDataBufSize As Long, intZeroPos As Integer, r As Long
r = RegOpenKey(HKEY, strPath, keyhand)
lResult = RegQueryValueEx(keyhand, strValue, 0&, lValueType, ByVal 0&, lDataBufSize)
If lValueType = REG_SZ Then
strBuf = String(lDataBufSize, " ")
lResult = RegQueryValueEx(keyhand, strValue, 0&, 0&, ByVal strBuf, lDataBufSize)
If lResult = ERROR_SUCCESS Then
intZeroPos = InStr(strBuf, Chr$(0))
If intZeroPos > 0 Then
GetString = Left$(strBuf, intZeroPos - 1)
Else
GetString = strBuf
End If
End If
End If
RegCloseKey keyhand
End Function
Public Function SaveString(HKEY As MAINKEY, strPath As String, strValue As String, strdata As String)
Dim keyhand As Long, r As Long
r = RegCreateKey(HKEY, strPath, keyhand)
r = RegSetValueEx(keyhand, strValue, 0, REG_SZ, ByVal strdata, Len(strdata))
r = RegCloseKey(keyhand)
End Function
Public Function CreateKey(HKEY As MAINKEY, strPath As String)
Dim keyhand&, r As Long
r = RegCreateKey(HKEY, strPath, keyhand&)
r = RegCloseKey(keyhand&)
End Function
Public Function DeleteKey(ByVal HKEY As MAINKEY, ByVal strKey As String)
Dim r As Long
r = RegDeleteKey(HKEY, strKey)
End Function
Public Function DeleteString(ByVal HKEY As MAINKEY, ByVal strPath As String, ByVal strValue As String)
Dim keyhand As Long, r As Long
r = RegOpenKey(HKEY, strPath, keyhand)
r = RegDeleteValue(keyhand, strValue)
r = RegCloseKey(keyhand)
End Function
Сейчас этот форум просматривают: AhrefsBot и гости: 88