VB.net2010 操作注册表的完整路径写在HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Run
就可以自启动了 。
以下是我前一段时间写的防u盘自动运行的程序,里面可以找到如何操作注册表 。
Option Explicit
Global Const REG_SZ As Long = 1
Global Const REG_DWORD As Long = 4
Global Const HKEY_CLASSES_ROOT = H80000000
Global Const HKEY_CURRENT_USER = H80000001
Global Const HKEY_LOCAL_MACHINE = H80000002
Global Const HKEY_USERS = H80000003
Global Const ERROR_NONE = 0
Global Const ERROR_BADDB = 1
Global Const ERROR_BADKEY = 2
Global Const ERROR_CANTOPEN = 3
Global Const ERROR_CANTREAD = 4
Global Const ERROR_CANTWRITE = 5
Global Const ERROR_OUTOFMEMORY = 6
Global Const ERROR_INVALID_PARAMETER = 7
Global Const ERROR_ACCESS_DENIED = 8
Global Const ERROR_INVALID_PARAMETERS = 87
Global Const ERROR_NO_MORE_ITEMS = 259
Global Const KEY_ALL_ACCESS = H3F
Global Const REG_OPTION_NON_VOLATILE = 0
Declare Function RegCloseKey Lib "advapi32.dll" (ByVal hkey As Long) As Long
Declare Function RegOpenKeyEx Lib "advapi32.dll" Alias "RegOpenKeyExA" (ByVal hkey As Long, ByVal lpSubKey As String, ByVal ulOptions As Long, ByVal samDesired As Long, phkResult As Long) As Long
Declare Function RegQueryValueEx Lib "advapi32.dll" Alias "RegQueryValueExA" (ByVal hkey As Long, ByVal lpValueName As String, ByVal lpReserved As Long, lpType As Long, lpData As Long, lpcbData As Long) As Long
Declare Function RegSetValueEx Lib "advapi32.dll" Alias "RegSetValueExA" (ByVal hkey As Long, ByVal lpValueName As String, ByVal Reserved As Long, ByVal dwType As Long, lpValue As Long, ByVal cbData As Long) As Long
Private Sub cmdAbout_Click()
MsgBox "作者wolfccb不对本软件可能造成的任何错误或损失负责,请自行承担使用风险 。", vbInformation, "About"
End Sub
Private Sub cmdDefault_Click()
Check0.Value = https://www.04ip.com/post/1
Check1.Value = https://www.04ip.com/post/0
Check2.Value = https://www.04ip.com/post/1
Check3.Value = https://www.04ip.com/post/0
Check4.Value = https://www.04ip.com/post/1
Check5.Value = https://www.04ip.com/post/0
Check6.Value = https://www.04ip.com/post/0
End Sub
Private Sub cmdExit_Click()
Unload Me
End Sub
Private Sub cmdRecommend_Click()
Check0.Value = https://www.04ip.com/post/1
Check1.Value = https://www.04ip.com/post/1
Check2.Value = https://www.04ip.com/post/1
Check3.Value = https://www.04ip.com/post/1
Check4.Value = https://www.04ip.com/post/1
Check5.Value = https://www.04ip.com/post/0
Check6.Value = https://www.04ip.com/post/1
End Sub
Private Sub cmdSet_Click()
Dim hkey As Long
Dim lvalue As Long
Dim cddata As Long
Dim retval As Long
lvalue = https://www.04ip.com/post/GetValue
retval = RegOpenKeyEx(HKEY_CURRENT_USER, "Software\Microsoft\Windows\CurrentVersion\Policies\Explorer", 0, KEY_ALL_ACCESS, hkey)
retval = RegSetValueEx(hkey, "NoDriveTypeAutoRun", 0, REG_DWORD, lvalue, 4)
RegCloseKey hkey
If retval = 0 Then
MsgBox "设置已保存 。", vbInformation, "提示"
Else
MsgBox "保存失败,错误代码:"CStr(retval), vbExclamation, "错误"
End If
End Sub
Private Sub Form_Load()
Dim hkey As Long
Dim lvalue As Long
Dim cddata As Long
Dim retval As Long
retval = RegOpenKeyEx(HKEY_CURRENT_USER, "Software\Microsoft\Windows\CurrentVersion\Policies\Explorer", 0, KEY_ALL_ACCESS, hkey)
If retval0 Then
MsgBox "打开注册表失败,错误代码:"CStr(retval), vbExclamation, "错误"
End If
retval = RegQueryValueEx(hkey, "NoDriveTypeAutoRun", 0, REG_DWORD, lvalue, 4)
RegCloseKey hkey
If retval0 Then
MsgBox "读取注册表失败,错误代码:"CStr(retval), vbExclamation, "错误"
End If
ShowCheck (lvalue)
End Sub
Private Sub ShowCheck(lvalue As Long)
Check0.Value = https://www.04ip.com/post/lvalue Mod 2
lvalue = https://www.04ip.com/post/(lvalue - Check0.Value) / 2
Check1.Value = https://www.04ip.com/post/lvalue Mod 2
lvalue = https://www.04ip.com/post/(lvalue - Check1.Value) / 2
Check2.Value = https://www.04ip.com/post/lvalue Mod 2
lvalue = https://www.04ip.com/post/(lvalue - Check2.Value) / 2
Check3.Value = https://www.04ip.com/post/lvalue Mod 2
lvalue = https://www.04ip.com/post/(lvalue - Check3.Value) / 2
Check4.Value = https://www.04ip.com/post/lvalue Mod 2
lvalue = https://www.04ip.com/post/(lvalue - Check4.Value) / 2
Check5.Value = https://www.04ip.com/post/lvalue Mod 2
lvalue = https://www.04ip.com/post/(lvalue - Check5.Value) / 2
Check6.Value = https://www.04ip.com/post/lvalue Mod 2
End Sub
Private Function GetValue() As Long
GetValue = https://www.04ip.com/post/Check0.ValueCheck1.Value * 2Check2.Value * 4Check3.Value * 8Check4.Value * 16Check5.Value * 32Check6.Value * 64128
End Function
以上 。
饿的老狼
VB.net 中如何实现序列号注册功能思路是:
读取电脑硬件的信息,用随机数加工这些信息后在注册表中做个记录,用这个记录生成注册码送回给你,你按特定的方法生成序列号,你的小程序收到序列号后还原成数据,数据比较注册表中的记录,如果正确就加入第二部分注册的信息完成注册.你的程序每次打开时,先比对硬件信息-第一注册信息-第二注册信息,看这三者是否统一,不统一的就是使用期软件.
也可以省了第一注册信息,直接发硬件信息给你生成序列号,其他的相同.
vb中注册代码怎么写,要求要测试成功!最简单的一个是,在启动窗体中,加入一行代码:if inputbox("请输入注册码","注册",123")“123456” then end'这个是说,如果输入的不是123456,就退出程序 , 正确后就向下执行 。如果要注册码与用户名相结合,则要先用用户名作为种子,进行加密操作 , 生成一个注册码 , 成一一对应关系就行了 。如用户名为abc , 代码如下:dim a as string,b as string,i as integer,k as integera=inputbox("请输入用户名","注册用户")for i = 1 to len(a)b=bstr(asc(mid(a,i,1)))next ib=6bif b-int(len(b)/2)*2 = 1 then b = b4text1 = "用户名是:"aa=""for i = 1 to len(b) step 2if mid(b,i,2)32 thena=astr(mid(b,i,2) 32)elseifmid(b,i,2) 126 thena=astr(mid(b,i,2)-32)elsea=astr(mid(b,i,2))end ifend ifnext itext1 = text1"注册码是:"a这样就可以了
VB.NET 注册代码写两个函数,一个检测是否有重复用户,第二个插入
检测属用户是否存在
private function checkUser(byval uname as string) as boolean
dim sql as string = "select * from [user] where username="uname
dim cmd as sqlcommand = new sqlcommand(sql,conn)
dim read as sqldatareader = cmd.excutereader
dim result as boolean = read.hasrows
cmd=nothing
return result
end function
新增用户
private sub adduser(byval uname as string,byval password as string)
if checkUser(uname)
messagebox.show("用户已存在")
exit sub
end if
try
dim sql as string = "insert into [user](username,password) values(@uname,@upass)"
dim cmd as sqlcommand = new sqlcommand(sql,conn)
cmd.parameters.add("@uname",sqldbtype.varchar).value=https://www.04ip.com/post/uname
cmd.parameters.add("@upass",sqldbtype.varchar).value=https://www.04ip.com/post/password
cmd.ExecuteNonQuery
cmd=nothing
messagebox.show("用户添加成功!")
catch ex As Exception
messagebox.show("用户添加失败!"ex.message)
end try
end sub
【vb.net10注册码 vbsedit注册码】vb.net10注册码的介绍就聊到这里吧,感谢你花时间阅读本站内容,更多关于vbsedit注册码、vb.net10注册码的信息别忘了在本站进行查找喔 。
推荐阅读
- 关于redisinit的信息
- 为什么手机拍摄很卡,为什么手机拍照会卡住
- 益智小游戏自制数字玩具,自制益智玩具幼儿园数字
- word2007有什么用,word2007是一种什么软件
- php数据库统计 php数据统计分析
- 安卓好玩有趣的app,好玩又有趣的手工
- 手机升级鸿蒙如何操作电脑,手机系统升级鸿蒙
- mysql怎么做分库分表 关于雪糕的打油诗
- pg处理表数据,pg清空表数据sql