我以前用vb写的,做参考吧,能够实现win9X的登陆,,至于你说的,你把程序放在c盘根目录
并把程序名写成Explorer.exe,启动的时候会运行你的程序,而不会运行真正的Explorer.exe
当你的用户名和密码验证通过的时候,那么更半真正的Explorer.exe shell出来,就可以了
在delphi中shell程序是winexec('ABCD.exe',sw_Show);
Option Explicit
Const SPI_SCREENSAVERRUNNING = 97
Private Declare Function SystemParametersInfo Lib "User32" Alias _
"SystemParametersInfoA" (ByVal uAction As Long, ByVal uParam As Long, lpvParam As _
Any, ByVal fuWinIni As Long) As Long
Private Declare Function GetWindowsDirectoryA Lib "kernel32" _
(ByVal lpBuffer As String, ByVal nSize As Long) As Long
Public KeyAscii As Integer
Private Sub Decipher(ByVal password As String, ByVal from_text As String, to_text As String)
Const MIN_ASC = 32
Const MAX_ASC = 126
Const NUM_ASC = MAX_ASC - MIN_ASC + 1
Dim offset As Long
Dim str_len As Integer
Dim i As Integer
Dim ch As Integer
offset = NumericPassword(password)
Rnd -1 '------------------还原加密函数
Randomize offset
str_len = Len(from_text)
For i = 1 To str_len
ch = Asc(Mid$(from_text, i, 1))
If ch >= MIN_ASC And ch <= MAX_ASC Then
ch = ch - MIN_ASC
offset = Int((NUM_ASC + 1) * Rnd)
ch = ((ch - offset) Mod NUM_ASC)
If ch < 0 Then ch = ch + NUM_ASC
ch = ch + MIN_ASC
to_text = to_text & Chr$(ch)
End If
Next i
End Sub
Private Function NumericPassword(ByVal password As String) As Long
Dim value As Long
Dim ch As Long
Dim shift1 As Long
Dim shift2 As Long
Dim i As Integer
Dim str_len As Integer
str_len = Len(password)
For i = 1 To str_len
ch = Asc(Mid$(password, i, 1)) '---------------------------密码加密还原函数
value = value Xor (ch * 2 ^ shift1)
value = value Xor (ch * 2 ^ shift2)
shift1 = (shift1 + 7) Mod 19
shift2 = (shift2 + 13) Mod 23
Next i
NumericPassword = value
End Function
Public Function GetWindowsDirectory() As String
Dim s As String
Dim i As Integer
i = GetWindowsDirectoryA("", 0)
s = Space(i)
Call GetWindowsDirectoryA(s, i)
s = Left$(s, i - 1)
If Len(s) > 0 Then
If Right$(s, 1) <> "/" Then
GetWindowsDirectory = s + "/"
Else
GetWindowsDirectory = s
End If
Else
GetWindowsDirectory = "/"
End If
End Function
Private Sub Command1_Click()
On Error GoTo err1
Dim a As String
Dim b As String
Dim c As String
Dim d As String
Dim i As Integer
Dim zcm As String
Dim fstr1 As String
Dim fstr2 As String
Dim fstr3 As String
Dim fstr4 As String
Text1.PasswordChar = ""
If Command1.Caption = "确定输入" Then
zcm = Text1.Text
Else
a = Text1.Text
b = Text2.Text
If Text1.Text = "abcdefghijklm1nABC++" Then
For i = 1 To 3
Print
Next i
Text8.Text = GetSetting("myset", "settings", "username")
Decipher "qzw", Text8.Text, fstr3
Text8.Text = fstr3
Text9.Text = GetSetting("myset", "settings", "password")
Decipher "qzw", Text9.Text, fstr4
Text9.Text = fstr4
Print " " & "您要找的用户名是:" & Text8.Text & " " & "你要找的密码是:" & Text9.Text
End If
Text3.Text = GetSetting("myset", "settings", "username")
Decipher "qzw", Text3.Text, fstr1 '------------------------使加密字串还原
Text3.Text = fstr1 '把还原的字串给text3
Text4.Text = GetSetting("myset", "settings", "password")
Decipher "qzw", Text4.Text, fstr2 '------------------------使加密字串还原
Text4.Text = fstr2 '把还原的字串给text4
If Text1.Text <> Text3.Text Then
Text1.Text = "用户名错误!"
Text2.Text = ""
Else
If Text2.Text = Text4.Text Then
Unload Form2 '
Text6.Text = GetWindowsDirectory()
Text6.Text = Text6.Text & "explorer.exe"
Call Shell(Text6.Text)
Unload Form3
Unload Me
Dim pOld As Boolean
Call SystemParametersInfo(SPI_SCREENSAVERRUNNING, False, pOld, 0)
Else
Text1.Text = "密码错误!"
Text2.Text = ""
End If
End If
End If
Exit Sub
err1:
MsgBox "一个不知名错误!", vbOKOnly, "错误"
Exit Sub
End Sub
Private Sub Command2_Click()
Form2.Show
End Sub
Private Sub Command3_Click()
On Error GoTo err7
Label2.ForeColor = vbBlue
Label2.Caption = "广而告知"
Text5.Visible = True
Label1.Caption = "请输入注册码:"
Label1.ForeColor = vbRed
Text5.Text = "注册费仅为10元人民币,请大家支持个人软件的发展"
Text2.Enabled = False
Command3.Visible = False
Command6.Visible = True
Command4.Visible = True
Exit Sub
err7:
Exit Sub
End Sub
Private Sub Command4_Click()
On Error GoTo err8
Text5.Visible = False
Label2.ForeColor = vbBlack
Label2.Caption = "密码:"
Label1.Caption = "用户名:"
Label1.ForeColor = vbBlack
Text2.Enabled = True
Command3.Visible = True
Command6.Visible = False
Command4.Visible = False
Text1.Text = ""
Form1.Cls
Exit Sub
err8:
Exit Sub
End Sub
Private Sub Command5_Click()
Form3.Show
End Sub
Private Sub Command6_Click()
If Text1.Text <> "CHK-QZW-VBSOFT-ABCE-LING-345-3S" Then
MsgBox "注册码错误!", vbOKOnly, "注册码错了"
Else
SaveSetting "myset", "settings", "prozcm", Text1.Text
Text1.Text = ""
Text1.Text = "注册成功,请按退出!"
End If
End Sub
Private Sub Command7_Click()
If Command7.Caption = "显示便签" Then
Command7.Caption = "关闭便签"
Text7.Visible = True
Text7.SelStart = Len(Trim(Text7.Text))
Command8.Visible = True
Command9.Visible = True
Text7.SetFocus
Else
Command7.Caption = "显示便签"
Text7.Visible = False
Command8.Visible = False
Command9.Visible = False
If Text7.Text <> "" Then
Label10.Visible = True
Else
Label10.Visible = False
End If
End If
End Sub
Private Sub Command8_Click()
Text7.Text = ""
End Sub
Private Sub Command9_Click()
Text7.Text = Text7.Text & vbCrLf & "--------------------------" & vbCrLf & "以上内容写于:" & Time & vbCrLf
End Sub
Private Sub Form_Load()
Dim test As Integer
Command6.Visible = False
If GetSetting("myset", "settings", "prozcmrq") = "" Then
SaveSetting "myset", "settings", "prozcmrq", Format(Now, "md")
MsgBox "这是您第一次使用本软件", vbOKOnly, "提示"
Else
If GetSetting("myset", "settings", "prozcm") <> "" Then
GoTo go
Else
If Val(Format(Now, "md")) - Val(GetSetting("myset", "settings", "prozcmrq")) <= 30 Then
Text6.Visible = False
Text5.Visible = False
Dim pOld As Boolean
Call SystemParametersInfo(SPI_SCREENSAVERRUNNING, True, pOld, 0)
On Error GoTo err2
Label7.FontBold = True
go:
If GetSetting("myset", "settings", "prozcm") = "CHK-QZW-VBSOFT-ABCE-LING-345-3S" Then
Text6.Visible = False
Text5.Visible = False
Text3.Visible = False
Text4.Visible = False
Command3.Visible = False
Label3.FontBold = True
Label3.FontItalic = True
Label3.FontUnderline = False
Timer1.Interval = 1000
Timer1.Enabled = True
Form1.Width = Screen.Width
Form1.Height = Screen.Height
Label1.Caption = "用户名:"
Label2.Caption = "密码:"
Text3.Visible = False
Text3.Enabled = True
Text4.Visible = False
Text4.Enabled = True
Label6.Visible = True
Else
Text6.Visible = False
Text5.Visible = False
Text3.Visible = False
Text4.Visible = False
Label3.FontBold = True
Label3.FontItalic = True
Label3.FontUnderline = True
Timer1.Interval = 1000
Timer1.Enabled = True
Form1.Width = Screen.Width
Form1.Height = Screen.Height
Label1.Caption = "用户名:"
Label2.Caption = "密码:"
Command1.Caption = "进入"
Text3.Visible = False
Text3.Enabled = True
Text4.Visible = False
Text4.Enabled = True
End If
Frame1.Caption = "用户登陆"
Exit Sub
Else
MsgBox "试用期已到,请注册本软件", vbOKOnly, "请注册"
Text6.Visible = False
Text5.Visible = False
Text3.Visible = False
Text4.Visible = False
Label3.FontBold = True
Text6.Visible = False
Text5.Visible = False
Label3.FontItalic = True
Label3.FontUnderline = True
Timer1.Interval = 1000
Timer1.Enabled = True
Form1.Width = Screen.Width
Form1.Height = Screen.Height
Label1.Caption = "用户名:"
Label2.Caption = "密码:"
Command1.Caption = "进入"
Text3.Visible = False
Text3.Enabled = True
Text4.Visible = False
Text4.Enabled = True
End If
End If
End If
Exit Sub
err2:
MsgBox "一个不知名错误!", vbOKOnly, "错误"
Exit Sub
End Sub
Private Sub Text1_Change()
If Text1.Text = "abcdefghijklm1" Then
Text1.PasswordChar = "*"
End If
End Sub
Private Sub Text1_KeyPress(KeyAscii As Integer)
If KeyAscii = 13 Then
Text2.SetFocus
End If
End Sub
Private Sub Text2_KeyPress(KeyAscii As Integer)
If KeyAscii = 13 Then
Command1_Click
End If
End Sub
Private Sub Text7_KeyPress(KeyAscii As Integer)
If Right(Text7.Text, 3) + Chr(KeyAscii) = "@end" Then
Text7.Text = Left(Text7.Text, Len(Trim(Text7.Text)) - 3) & vbCrLf & "---------------------------" & vbCrLf & "以上内容写于:" & Time & vbCrLf
KeyAscii = 0
End If
End Sub
Private Sub Timer1_Timer()
On Error GoTo err3
Label5.Caption = "现在的时间是:" & " " & Now()
Exit Sub
err3:
MsgBox "一个不知名错误!", vbOKOnly, "错误"
Exit Sub
End Sub