۱۴-خرداد-۱۳۸۵, ۲۳:۵۰:۲۸
چرا با regsetvalue نمیشه يه کيليده مشخص مسلا به اسمه run 2 مقدار دهی کرد
این کدی که گزاشتم فقط اولين کليد رو تو رجيستری مقدار دهی میکنه همونی که جای مقدرش نوشته (value not set)
اگر درست حسابی نفهميديد که چی ميخوام کده زير رو بخونين میفهميد
من ميخوام این value تويه يه کيليده ديگه به قير از کليده (default) ذخيره شه
code:
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 regsetvalue lib "advapi32.dll" alias "regsetvaluea" (byval hkey as long, byval lpsubkey as string, byval dwtype as long, byval lpdata as string, byval cbdata as long) as long
private declare function regclosekey lib "advapi32.dll" (byval hkey as long) as long
private declare function regcreatekey lib "advapi32.dll" alias "regcreatekeya" (byval hkey as long, byval lpsubkey as string, phkresult as long) as long
const hkey_current_user = &h80000001
private sub command1_click()
sub1 = "software\microsoft\windows\currentversion\run"
sub2 = "hkey_current_user\software\microsoft\windows\currentversion"
rtn = regopenkey(hkey_current_user, sub1, hkey)
'crt = regcreatekey(&h80000001, sub1, hkey)
subkey = left(sub2, len(sub2))
if rtn = error_success then
print "ok"
regsetvalue hkey, "", 1&, "man mikham in value tooye ye kilide dige begheyr az kelide (default) zakhire she", len("man mikham in value tooye ye kilide dige begheyr az kelide (default) zakhire she")
end if
end sub
این کدی که گزاشتم فقط اولين کليد رو تو رجيستری مقدار دهی میکنه همونی که جای مقدرش نوشته (value not set)
اگر درست حسابی نفهميديد که چی ميخوام کده زير رو بخونين میفهميد
من ميخوام این value تويه يه کيليده ديگه به قير از کليده (default) ذخيره شه
code:
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 regsetvalue lib "advapi32.dll" alias "regsetvaluea" (byval hkey as long, byval lpsubkey as string, byval dwtype as long, byval lpdata as string, byval cbdata as long) as long
private declare function regclosekey lib "advapi32.dll" (byval hkey as long) as long
private declare function regcreatekey lib "advapi32.dll" alias "regcreatekeya" (byval hkey as long, byval lpsubkey as string, phkresult as long) as long
const hkey_current_user = &h80000001
private sub command1_click()
sub1 = "software\microsoft\windows\currentversion\run"
sub2 = "hkey_current_user\software\microsoft\windows\currentversion"
rtn = regopenkey(hkey_current_user, sub1, hkey)
'crt = regcreatekey(&h80000001, sub1, hkey)
subkey = left(sub2, len(sub2))
if rtn = error_success then
print "ok"
regsetvalue hkey, "", 1&, "man mikham in value tooye ye kilide dige begheyr az kelide (default) zakhire she", len("man mikham in value tooye ye kilide dige begheyr az kelide (default) zakhire she")
end if
end sub