Ik heb een progje gemaakt in vb enzow. Hartstikke leuk, maar nou wil ik weten hoe ik kan bepalen of een bepaalde sleutel (die door mijn progje is geschreven in t register) aanwezig is?
Alvast bedankt
Alvast bedankt
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
| '**************************************
' Name: ______A Edit Registry
' Description:How to Read and Write to t
' he Registry using all HKEYS
' By: Agent Smith
'
'This code is copyrighted and has' limited warranties.Please see http://w
' ww.1VbStreet.com/xq/ASP/txtCodeId.10479/
' lngWId.1/qx/vb/scripts/ShowCode.htm'for details.'**************************************
Public Function bSetRegValue(ByVal hKey As Long, ByVal lpszSubKey As String, ByVal sSetValue As String, ByVal sValue As String) As Boolean
On Error Resume Next
Dim phkResult As Long
Dim lResult As Long
Dim SA As SECURITY_ATTRIBUTES
Dim lCreate As Long
RegCreateKeyEx hKey, lpszSubKey, 0, "", REG_OPTION_NON_VOLATILE, KEY_ALL_ACCESS, SA, phkResult, lCreate
lResult = RegSetValueEx(phkResult, sSetValue, 0, REG_SZ, sValue, CLng(Len(sValue) + 1))
RegCloseKey phkResult
bSetRegValue = (lResult = ERROR_SUCCESS)
End Function
Public Function bGetRegValue(ByVal hKey As Long, ByVal sKey As String, ByVal sSubKey As String) As String
Dim lResult As Long
Dim phkResult As Long
Dim dWReserved As Long
Dim szBuffer As String
Dim lBuffSize As Long
Dim szBuffer2 As String
Dim lBuffSize2 As Long
Dim lIndex As Long
Dim lType As Long
Dim sCompKey As String
lIndex = 0
lResult = RegOpenKeyEx(hKey, sKey, 0, 1, phkResult)
Do While lResult = ERROR_SUCCESS And Not (bFound)
szBuffer = Space(255)
lBuffSize = Len(szBuffer)
szBuffer2 = Space(255)
lBuffSize2 = Len(szBuffer2)
lResult = RegEnumValue(phkResult, lIndex, szBuffer, lBuffSize, dWReserved, lType, szBuffer2, lBuffSize2)
If (lResult = ERROR_SUCCESS) Then
sCompKey = Left(szBuffer, lBuffSize)
If (sCompKey = sSubKey) Then
bGetRegValue = Left(szBuffer2, lBuffSize2 - 1)
End If
End If
lIndex = lIndex + 1
Loop
RegCloseKey phkResult
End Function |
Verwijderd
Hey bedankt. Ik had net al eerst geprobeert If Getsetting(blabla) ThenVerwijderd schreef op 03 november 2002 @ 10:31:
Tja lijkt me ook. Gewoon met Getsetting de waarde ophalen en checken of deze leeg is.
Bijv. een Ifje:
If strA = "" then
blabla
Let wel op dat alles in het register opgeslagen wordt als string.
Verwijderd
1
2
3
4
5
6
7
| Dim X as Single X = Form1.Left Dim Y As Single Y = Form1.Top SaveSetting "Appnaam", "Sectie", "Sleutel", CStr(X) SaveSetting "Appnaam", "Sectie", "Sleutel", CStr(Y) |
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
| Dim X As Single
Dim strX as String
strX = GetSetting(Appname:="Appnaam", section:="Sectie", Key:="Sleutel"
If strX <> "" Then
X = CSng(strX) Else
X = 9660
End If
Form1.Left = X
Dim Y As Single
Dim strY as String
strY = GetSetting(Appname:="Appnaam", section:="Sectie", Key:="Sleutel"
If strY <> "" Then
X = CSng(strX) Else
X = 0
End If
Form1.Top = Y |
If you can't convince them with facts, dazzle them with bullshit