幫我寫vb程式,或者vbs指令碼也行,建立登錄檔項並寫入內容

2021-05-07 08:56:25 字數 2025 閱讀 3188

1樓:孤星

vbs指令碼寫入登錄檔:

----------

set ws=createobject("wscript.shell")

ws.regwrite "項路徑\子鍵名\鍵值","鍵值資料" ,"鍵值型別"

----------

例:ws.regwrite "hkey_classes_root\hkcr.ensp\enspfile","123.exe" ,"reg_sz"

在hkcr項下建立子項hkcr.ensp,右側建立reg_sz型別的鍵值enspfile,賦資料為123.exe

2樓:匿名使用者

1.建立一個按鈕,名稱為「寫入登錄檔」。

2.宣告部分:

option explicit

public const reg_none = 0

public const reg_sz = 1

public const reg_expand_sz = 2

public const reg_binary = 3

public const reg_dword = 4

public const reg_dword_big_endian = 5

public const reg_multi_sz = 7

declare function regopenkey lib "advapi32.dll" alias "regopenkeya"

(byval hkey as long, byval lpsubkey as string, phkresult as long) as long

declare function regclosekey lib "advapi32.dll" (byval hkey 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, lpdata as any, byval cbdata as long) as long

3.再就是名稱為「寫入註冊」按鈕的click事件:

private sub 寫入登錄檔_click()

dim ret as long, hkey as long,rvalue as string

rvalue="value名稱為enspfile的鍵值"

ret = regcreatekey(hkey_classes_root,"ensp",hkey)

if ret=0 then

ret=regsetvalueex(hkey,"enspfile",0,reg_sz,byval rvalue,lenb(rvalue)+1)

if ret<>0 then

msgbox "寫入鍵值失敗!"

end if

else

msgbox "建立子鍵hkey_classes_root\ensp失敗!"

end if

regclosekey hkey

end sub

我還不太瞭解你的具體意思,以上是我根據自己的判斷回答的,不知道對不對的你意思。應該很好看懂,你稍微改點就ok了。

急求的演算法,vb或者vbs

rem 公式 用 4 1 1 3 1 5 1 7 級數求 的近似值 private sub form click dim s as double,pi as double,i as double s 0 for i 1 to 100000 上限越大,的精度越高s s 1 2 i 1 1 i 1 ne...

關於vb寫程式的問題

不能用減法的,如果這一天是週日那到一減就成了 周0 啦我的方法是這樣的,要改一下才行 private sub form click x 1 9 2005 a x date select case weekday x case 1 b 日 case 2 b 一 case 3 b 二 case 4 b ...

請教vb大佬這個程式應該怎麼寫求VB大佬看看!!謝謝!!程式碼怎麼寫!!

private sub mand1 click c left inputbox 請輸入表示星期的第一個字母 1 c ucase c if c m then w monday elseif c w then w wednesday elseif c f then w friday elseif c s...