這是為什麼啊?望高人指點啊.
private sub form_load()
dim machine as string
dim machine_decode as string
dim txtsql as string
dim mrc as adodb.recordset
dim msgtext as string
machine = getserialnumber("c:")
machine_decode = getserial()
text1.text = machine
txtsql = "select * from userenroll_info where machine = '" & machine & "' and decode='" & machine_decode & "'"
set mrc = executesql(txtsql, msgtext)
if mrc.eof then
msgbox "沒有註冊資訊!"
cmdok.visible = false
cmdenroll.visible = true
else
msgbox "找到註冊資訊"
cmdok.visible = true
cmdenroll.visible = false
label2.visible = false
label3.visible = false
text1.visible = false
text2.visible = false
end if
set mrc = nothing
end sub
private sub cmdok_click()
unload me
frmmain.show
end sub
private sub cmdcancel_click()
endend sub
function getserialnumber(strdrive as string) as long
dim serialnum as long
dim res as long
dim temp1 as string
dim temp2 as string
temp1 = string$(255, chr$(0))
temp2 = string$(255, chr$(0))
res = getvolumeinfomation(strdrive, temp1, len(temp1), serialnum, 0, 0, temp2, len(temp2))
getserialnumber = serialnum
end function
function getserial() as string
dim inputserial as string
dim n as string
dim n1 as string
dim n2 as string
dim p as long
dim p1 as long
dim p2 as long
dim i as long
p = 0
p1 = 0
p2 = 0
n = ""
n1 = ""
n2 = ""
n = str(getserialnumber("c:"))
n1 = ""
n2 = ""
if len(n) < 20 then
n = n + string(20 - len(n), "z")
n1 = n1 + string(20 - len(n), "a")
n2 = n2 + string(20 - len(n2), "h")
end if
for i = 1 to 20
p = p + asc(mid(n, i, 1)) * 199
p1 = p1 + asc(mid(n1, i, 1)) * 179
p2 = p2 + asc(mid(n2, i, 1)) * 109
next
inputseial = format(p) + "-" + format(p1) + "-" + format(p2)
getserialn = inputseial
end function
private declare function getvolumeinformation lib "kernel32" alias "getvolumeinformationa" (byval lprootpathname as string, byval lpvolumenamebuffer as string, byval nvolumenamesize as long, lpvolumeserialnumber as long, lpmaximumcomponentlength as long, lpfilesystemflags as long, byval lpfilesystemnamebuffer as string, byval nfilesystemnamesize as long) as long
private sub cmdenroll_click()
dim txtsql as string
dim mrc as adodb.recordset
dim msdtext as string
if len(text2.text) <> 20 then
msgbox "您輸入的註冊碼錯誤!"
exit sub
if text2.text <> getsrialn() then
msgbox "註冊碼錯誤,請重新輸入!"
exit sub
end if
on error goto err1
txtsql = "insert into userenroll_info(machine,decode) values('" & text1.text & "','" & text2.text & "')"
set mrc = executesql(txtsql, msgtext)
msgbox "註冊成功!"
cmdok.visible = true
cmdenroll.visible = false
label2.visible = false
label3.visible = false
text1.visible = false
text2.visible = false
exit sub
errl:
msgbox "新增註冊資訊失敗!"
end sub
還有乙個蘋果
曾經有人講過這樣乙個耐人尋味的故事 一場突然而來的沙漠風暴使一位旅行者迷失了前進方向。更可怕的是,旅行者裝水和乾糧的揹包也被風暴卷走了。他翻遍身上所有的口袋,找到了乙個青青的蘋果。啊,我還有乙個蘋果!旅行者驚喜地叫著。他緊握著那個蘋果,獨自在沙漠中尋找出路。每當乾渴 飢餓 疲乏襲來的時候,他都要看一...
VB 乙個正則提取功能
引用 microfoft vbscript regular expressions 5.5 乙個正則提取功能 public function reggetstr three byval mystring as string,byval patreg as string as string dim o...
乙個VB陣列指標類
顧名思義了,這個 就是將指定的記憶體位址繫結到乙個vb陣列,即com中的safearray上。所謂繫結,是指在使用該記憶體位址之前,並不需要申請相應的本地記憶體緩衝區,也不需要進行記憶體複製,只是根據該位址憑空構造乙個vb陣列,並將陣列的真實資料位址指向該位址。當然,該類的功能完全可以用copyme...