您的位置:程序门 -> vb -> 基础类



请问这个哪有问题 新手 谢谢


[收藏此页] [打印本页]选择字色:背景色:字体:[][][]


请问这个哪有问题 新手 谢谢
发表于:2007-12-29 11:43:43 楼主
const   hkey_local_machine   =   &h80000002
const   reg_dword   =   4
private   declare   function   regsetvalueex   lib   "advapi32.dll"   alias   "regsetvalueexa"   (byval   hkey   as   long,   byval   lpvaluename   as   string,   byval   reserved   as   long,   byval   dwtype   as   long,   lpdata   as   any,   byval   cbdata   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
private   declare   function   regclosekey   lib   "advapi32.dll"   (byval   hkey   as   long)   as   long
private   declare   function   regopenkey   lib   "advapi32.dll"   alias   "regopenkeya"   (byval   hkey   as   long,   byval   lpsubkey   as   string,   phkresult   as   long)   as   long
'过程
private   sub   setkeydwordvalue(byval   key   as   string,   byval   subkey   as   string,   byval   keyvalue_dword   as   long)
dim   keyid   as   long
keystatus   =   regcreatekey(hkey_local_machine,   key,   keyid)
keystatus   =   regcreatekey(hkey_local_machine,   key,   keyid)
keystatus   =   regsetvalueex(keyid,   subkey,   0&,   reg_dword,   keyvalue_dword,   lenb(keyvalue_dword))
keystatus   =   regclosekey(keyid)
end   sub

private   sub   btn_test_click()
        call   setkeydwordvalue("system\controlset001\control\class\{4d36e972-e325-11ce-bfc1-08002be10318}\0001",   "networkaddress",   "12345148e1eb")   '修改mac物理地址
end   sub


问题触发btn_test按纽提示   “类型不匹配”   请问什么错误原因     在线谢谢
发表于:2007-12-29 11:55:331楼 得分:0
vbscript code
'改成这样试试 private sub btn_test_click() call setkeydwordvalue("system\controlset001\control\class\{4d36e972-e325-11ce-bfc1-08002be10318}\0001", "networkaddress", val("12345148e1eb")) '修改mac物理地址 end sub
发表于:2007-12-29 12:21:142楼 得分:0
const       hkey_local_machine       =       &h80000002  
const       reg_sz       =       1  
private       declare       function       regsetvalueex       lib       "advapi32.dll"       alias       "regsetvalueexa"       (byval       hkey       as       long,       byval       lpvaluename       as       string,       byval       reserved       as       long,       byval       dwtype       as       long,       lpdata       as       any,       byval       cbdata       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  
private       declare       function       regclosekey       lib       "advapi32.dll"       (byval       hkey       as       long)       as       long  
private       declare       function       regopenkey       lib       "advapi32.dll"       alias       "regopenkeya"       (byval       hkey       as       long,       byval       lpsubkey       as       string,       phkresult       as       long)       as       long  
'过程  
private       sub       setkeydwordvalue(byval       key       as       string,       byval       subkey       as       string,       byval       keyvalue_dword       as       long)  
dim       keyid       as       long  
dim       keystatus       as       long  
keystatus       =       regcreatekey(hkey_local_machine,       key,       keyid)  
keystatus       =       regcreatekey(hkey_local_machine,       key,       keyid)  
keystatus       =       regsetvalueex(keyid,       subkey,       0&,       reg_sz,       keyvalue_dword,       lenb(keyvalue_dword))  
keystatus       =       regclosekey(keyid)  
end       sub  

private       sub       btn_test_click()  
                call       setkeydwordvalue("system\controlset001\control\class\{4d36e972-e325-11ce-bfc1-08002be10318}\0001",       "networkaddress",       val("12345148e1eb"))       '修改mac物理地址  
end       sub  

键值变成乱码了不知道什么原因

发表于:2007-12-29 12:45:463楼 得分:0
那个键值?
发表于:2007-12-29 13:00:584楼 得分:0
hkey_local_machine\system\currentcontrolset\control\class\{4d36e972-e325-11ce-bfc1-08002be10318}\0000、0001、0002等主键下,查找driverdesc的内容,了解网卡使用了哪个主键(例如0001),如果主键下有params项,则该主键也是网卡所使用的;  

  例如网卡使用了0001主键,因此我们就选中它,在其右边建一个字符串项(名为networkaddress),双击该串,输入你指定的mac地址值(注意应该是12位的连续数字或字母,其间没有-号);在0001下的ndi\params中添加一项子键(名为networkaddress),选择该子键,在其右边添加名为default的字符串,键值为修改后的mac地址,与上面的数值相同;修改后重启生效。  

发表于:2007-12-29 13:07:175楼 得分:0
hkey_local_machine\system\controlset001\control\class\{4d36e972-e325-11ce-bfc1-08002be10318}\0001   networkaddress的键值     修改老乱码
发表于:2007-12-29 13:49:096楼 得分:0
ok   搞定了。现在没有乱码。

vbscript code
const hkey_local_machine = &h80000002 const reg_sz = 1 private declare function regsetvalueex lib "advapi32.dll" alias "regsetvalueexa" (byval hkey as long, byval lpvaluename as string, byval reserved as long, byval dwtype as long, lpdata as any, byval cbdata 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 private declare function regclosekey lib "advapi32.dll" (byval hkey as long) as long private declare function regopenkey lib "advapi32.dll" alias "regopenkeya" (byval hkey as long, byval lpsubkey as string, phkresult as long) as long '?程 private sub setkeydwordvalue(byval key as string, byval subkey as string, byval keyvalue_dword as string) dim keyid as long dim keystatus as long keystatus = regcreatekey(hkey_local_machine, key, keyid) regsetvalueex keyid, subkey, 0&, reg_sz, byval keyvalue_dword, len(keyvalue_dword) keystatus = regclosekey(keyid) end sub private sub btn_test_click() call setkeydwordvalue("system\controlset001\control\class\{4d36e972-e325-11ce-bfc1-08002be10318}\0001", "networkaddress", "12345148e1eb") '修改mac物理地址 end sub
发表于:2007-12-29 13:50:597楼 得分:0
可以结贴了吧。别忘了给分。


快速检索

最新资讯
热门点击