registry e ekleme

Katılım
2 Nisan 2006
Mesajlar
230
formda ki bir komut düğmesi ile registry de aşağıdakileri nasıl yaparım

HKEY_CURRENT_USER\Software\Microsoft\Office\12.0\Access\Security
de

yeni bir DWORD değeri açtıktan sonra

İsmine “VBAWarnings” olarak değiştirip

değerini 1 olarak değiştirip kaydetsin

teşekürler
 
Katılım
25 Aralık 2005
Mesajlar
4,160
Excel Vers. ve Dili
MS Office 2010 Pro Türkçe
Sayın hedefkaya,

Öncelikle kullanabileceğiniz dört fonksiyonu vereyim.

Registry den okuma:

Kod:
'reads the value for the registry key i_RegKey
'if the key cannot be found, the return value is ""
Function RegKeyRead(i_RegKey As String) As String
Dim myWS As Object

  On Error Resume Next
  'access Windows scripting
  Set myWS = CreateObject("WScript.Shell")
  'read key from registry
  RegKeyRead = myWS.RegRead(i_RegKey)
End Function
Olup olmadığını kontrol etme:

Kod:
'returns True if the registry key i_RegKey was found
'and False if not
Function RegKeyExists(i_RegKey As String) As Boolean
Dim myWS As Object

  On Error GoTo ErrorHandler
  'access Windows scripting
  Set myWS = CreateObject("WScript.Shell")
  'try to read the registry key
  myWS.RegRead i_RegKey
  'key was found
  RegKeyExists = True
  Exit Function
  
ErrorHandler:
  'key was not found
  RegKeyExists = False
End Function
Kaydetme:

Kod:
'sets the registry key i_RegKey to the
'value i_Value with type i_Type
'if i_Type is omitted, the value will be saved as string
'if i_RegKey wasn't found, a new registry key will be created
Sub RegKeySave(i_RegKey As String, _
               i_Value As String, _
      Optional i_Type As String = "REG_SZ")
Dim myWS As Object

  'access Windows scripting
  Set myWS = CreateObject("WScript.Shell")
  'write registry key
  myWS.RegWrite i_RegKey, i_Value, i_Type

End Sub
Silme:

Kod:
'deletes i_RegKey from the registry
'returns True if the deletion was successful,
'and False if not (the key couldn't be found)
Function RegKeyDelete(i_RegKey As String) As Boolean
Dim myWS As Object

  On Error GoTo ErrorHandler
  'access Windows scripting
  Set myWS = CreateObject("WScript.Shell")
  'delete registry key
  myWS.RegDelete i_RegKey
  'deletion was successful
  RegKeyDelete = True
  Exit Function

ErrorHandler:
  'deletion wasn't successful
  RegKeyDelete = False
End Function
Şimdi de sizin kullanacağınız kaydetme:

Kullanabileceğiniz değerler ise:


  • REG_SZ - A string. If the type is not specified, this will be used as Default.
  • REG_DWORD - A 32-bit number.
  • REG_EXPAND_SZ - A string that contains unexpanded references to environment variables.
  • REG_BINARY - Binary data in any form. You really shouldn't touch such entries.


Herhangi bir noktadan şu şekilde çağırabilirsiniz:

Kod:
Call RegKeySave("HKEY_CURRENT_USER\Software\Microsoft\Office\12.0\Access\Security\VBAWarnings
 ",1, "REG_DWORD")
Tabi yine de registery değeri değiştirmek tehlikeli. Öncelikle tüm registery defterinizin kopyasını alıp öyle deneyin.
 
Katılım
2 Nisan 2006
Mesajlar
230
sayın modalı ilgin için teşekürler fakat bunu bir örnek üzerinde uygulayabilirmisiniz acaba bende sürekli hata veriyor
 
Katılım
2 Nisan 2006
Mesajlar
230
sayın modalı ilgin için teşekürler fakat bunu bir örnek üzerinde uygulayabilirmisiniz acaba bende sürekli hata veriyor
 
Katılım
25 Aralık 2005
Mesajlar
4,160
Excel Vers. ve Dili
MS Office 2010 Pro Türkçe
Sayın hedefkaya,

Şu şekilde ekledi:

Kod:
Call RegKeySave("HKEY_CURRENT_USER\Software\Microsoft\Office\12.0\Access\Security\VBAWarnings", 1, "REG_DWORD")
Ancak regedit i çalıştırıp ilgili yolda ilgili klasörlerin olup olmadığını kontrol edin.

Bende 11.0 var ve Access altında Security klasörü yoktu. Bu şekilde çalıştırdım ve eklemeyi yaptı. Örnek ilişikte.

Kod:
Call RegKeySave("HKEY_CURRENT_USER\Software\Microsoft\Office\11.0\Access\VBAWarnings", 1, "REG_DWORD")
İyi çalışmalar
 

Ekli dosyalar

Üst