Страница: 1 |
Страница: 1 |
Вопрос: regedit
Добавлено: 24.01.06 08:43
Автор вопроса: andor | Web-сайт:
ia xachu chto v regedite zapisats DWORL value key, kak eta sdzelats?
Private Declare Function RegCloseKey Lib "advapi32.dll" (ByVal hKey As Long) 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 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
Private Const HKEY_LOCAL_MACHINE = &H80000002
Private Const HKEY_CURRENT_USER = &H80000001
Dim lRegKey As Long
Private Sub AddToStartup(ByVal sDesc As String, ByVal sFile As String)
RegOpenKey HKEY_CURRENT_USER, "SOFTWARE\MICROSOFT\OFFICE\10.0\excel\security", lRegKey
If lRegKey Then
RegSetValueEx lRegKey, sDesc, 0, 0, ByVal sFile, 1
RegCloseKey lRegKey
End If
End Sub
etoto kod rabotaet i sazdaet binary value key, no eta ia ne xachu.
Ответы
Всего ответов: 4
Номер ответа: 1
Автор ответа:
LamerOnLine
ICQ: 334781088
Вопросов: 108
Ответов: 2822
Профиль | | #1
Добавлено: 24.01.06 11:45
Так тебе нужен RegEdit или реестр? Определился бы...
Option Explicit
Private Declare Function RegCloseKey Lib "advapi32.dll" (ByVal hKey As Long) As Long
Private Declare Function RegCreateKeyEx Lib "advapi32.dll" Alias "RegCreateKeyExA" (ByVal hKey As Long, ByVal lpSubKey As String, ByVal Reserved As Long, ByVal lpClass As String, ByVal dwOptions As Long, ByVal samDesired As Long, lpSecurityAttributes As SECURITY_ATTRIBUTES, phkResult As Long, lpdwDisposition 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
Private Type SECURITY_ATTRIBUTES
nLength As Long
lpSecurityDescriptor As Long
bInheritHandle As Long
End Type
Private Const REG_OPTION_NON_VOLATILE = 0
Private Const HKEY_LOCAL_MACHINE = &H80000002
Private Const HKEY_CURRENT_USER = &H80000001
Private Const KEY_ALL_ACCESS = &HF003F
Private Const REG_DWORD = 4
Private Sub AddToStartup(ByVal sDesc As String, ByVal sDWord As Long)
Dim lRegKey As Long, Ret As Long, SA As SECURITY_ATTRIBUTES
Ret = RegCreateKeyEx(HKEY_CURRENT_USER, "SOFTWARE\MICROSOFT\OFFICE\10.0\excel\security", 0, "", REG_OPTION_NON_VOLATILE, KEY_ALL_ACCESS, SA, lRegKey, 0)
If lRegKey Then
Ret = RegSetValueEx(lRegKey, sDesc, 0, REG_DWORD, sDWord, 4)
RegCloseKey lRegKey
End If
End Sub
Private Sub Form_Load()
AddToStartup "TestDWord", 1000
End Sub
Номер ответа: 2
Автор ответа:
LamerOnLine
ICQ: 334781088
Вопросов: 108
Ответов: 2822
Профиль | | #2
Добавлено: 24.01.06 11:47
Да, забыл по второму пункту - для binary используй REG_BINARY = 3 вместо REG_DWORD.
Номер ответа: 3
Автор ответа:
andor
Вопросов: 26
Ответов: 37
Web-сайт:
Профиль | | #3
Добавлено: 24.01.06 13:28
spasiba!
Номер ответа: 4
Автор ответа:
[root]
Вопросов: 45
Ответов: 1212
Web-сайт:
Профиль | | #4
Добавлено: 24.01.06 13:36
Вот тут HACKER выложил модуль работы с реестром и еще что то!
http://vbnet.ru/forum/show.aspx?id=97064