Programalama > VISUAL BASIC


Ort. 0
Puan ver:
Registry girişine almak ve kaydetmek
‘girişe yazınız.
‘ HKEY_CURRENT_USER\Software\VB and VBA Program Settings\MyApp\Settings\
SaveSetting "MyApp", "Settings", "Left", 10
‘Debug penceresinden giriş ve çıkışları oku.
Debug.Print GetSetting("MyApp", "Settings", "Left", 4)
Registry’de Windows API kullanımı
Option Explicit
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 RegQueryValueExStr Lib "advapi32.dll" _
Alias "RegQueryValueExA" (ByVal hKey As Long, ByVal lpValueName _
As String, ByVal lpReserved As Long, lpType As Long, ByVal lpData As _
String, lpcbData As Long) As Long
Private Declare Function RegCloseKey Lib "advapi32.dll" (ByVal hKey As _
Long) As Long
Private Const HKEY_CURRENT_USER = &H80000001
Private Const REG_SZ = 1&
Private Sub Command1_Click()
Dim hKey As Long
Dim lRet As Long, lenData As Long
Dim sSubKey As String, sData As String
sSubKey = "Control Panel\Colors\"
lRet = RegOpenKey(HKEY_CURRENT_USER, sSubKey, hKey)
lenData = 255
sData = Space$(lenData)
lRet = RegQueryValueExStr(hKey, "ButtonFace", 0, REG_SZ, _
sData, lenData)
sData = Left$(lenData)
Debug.Print "The value is: " & sData
lRet = RegCloseKey(hKey)
End Sub


Yorumlar                 Yorum Yaz
Bu hazır kod'a ilk yorumu siz yapın!
KATEGORİLER
ASP - 240
ASP.NET - 24
C# - 75
C++ - 174
CGI - 8
DELPHI - 247
FLASH - 49
HTML - 536
PASCAL - 246
PERL - 11
PHP - 160
WML - 9
XML - 2
Copyright © 2002 - 2024 Hazır Kod - Tüm Hakları Saklıdır.
Siteden yararlanırken gizlilik ilkelerini okumanızı tavsiye ederiz.
hazirkod.com bir İSOBİL projesidir.