黑客X档案官方论坛's Archiver

凋零-晴天 发表于 2008-8-1 23:02

VB紧急求助

[table][tr][td]紧急求助!2008年7月份刊 总第75期书本:黑客编程 P96 动手打造VISTA版QQ登录器



我打开VB,按照源文件,把代码复制上去,FORM1  运行正常;
代码如下: 引用:[indent]Private Declare Function GetSystemDirectory Lib "kernel32" Alias "GetSystemDirectoryA" (ByVal lpBuffer As String, ByVal nSize As Long) As Long
'定义足够长的字符串
Const MAX_PATH = 260
'用来取得系统目录
Public Function GetWinSysDir() '读取Winddows\System 的所在目录的函数
Dim s As String, Length As Long
s = String(MAX_PATH, 0) '赋值
Length = GetSystemDirectory(s, MAX_PATH) 'S为取得目录,MAX_PATH 为长度
s = Left(s, InStr(s, Chr(0)) - 1) '去掉多余的空格
GetWinSysDir = s
End Function
'窗体载入事件
Private Sub Form_Load()
Me.Hide '隐藏本窗体
'定义变量
Dim sysDir As String
Dim tempfile() As Byte
tempfile = LoadResData(101, "custom") '从资源文件中取出控件
sysDir = GetWinSysDir '取得系统的 Windows\System32 的目录
If Dir(sysDir & "\vistaform.ocx ") = "" Then '判断控件是否存在,不存在的话创建一个
Open sysDir & "\vistaform.ocx" For Binary Access Write As #1 '创建控件
Put #1, , tempfile
Close #1
Shell "regsvr32 " & sysDir & "\vistaform.ocx /s", vbNormalFocus '注册控件
Form2.Show
Else:
'如果已经存在就跳过,直接显示登陆器
Form2.Show
Unload Me
End If
End Sub[/indent]
但是,FORM2 就出现了错误“未找到方法或数据成员”
代码如下: 引用:[indent]Dim QQpath As String
Dim QQnum As String
Dim QQpsw As String
Private Sub Form_Load()
'初始化控件
text1.Text = ""
Text2.Text = ""
Text2.PasswordChar = "*"

'窗体居中
Me.Move (Screen.Width - Me.Width) / 2, (Screen.Height - Me.Height) / 2
vistaform1.frmCaption = "QQ登陆器 "

vistaform1.Captionlen = 120 '80是1个字,200是10个字 80-200
vistaform1.Move -1000 '移动vista控件到左边,以免影响美观
vistaform1.Captioncolor = &HFF9ACD32 '字体颜色
'读取QQ安装目录
Set Reg = CreateObject("Wscript.Shell")
QQpath = Reg.RegRead("HKEY_LOCAL_MACHINE\SOFTWARE\Tencent\QQ\Install")
If QQpath = "" Then MsgBox "我找不到QQ路径哦~难道你没装?", vbCritical, "找不到QQ路径"
End Sub
Private Sub image1_Click()
'判断是否是珊瑚版的QQ
If Dir(QQpath & "coralQQ.exe") <> "" Then
QQpath = QQpath & "coralQQ.exe"
Else:
QQpath = QQpath & "QQ.exe"
End If
'检验信息是否完整
If text1.Text = "" And Text2.Text = "" Then
MsgBox "请填写正确的QQ号码和密码", vbCritical, "内容不完整"
Else:
QQnum = text1.Text & " "
QQpsw = Str2QQPwdHash(Text2.Text) '用模块对密码进行MD5+BASE6加密
'开始登录
Shell QQpath & " /START QQUIN:" & QQnum & "PWDHASH:" & QQpsw & " /STAT:41"
Unload Me
End If
End Sub[/indent]

附件[img]http://www.hackerxfiles.net/images/attachicons/image.gif[/img] [url=http://www.hackerxfiles.net/attachment.php?aid=19866&nothumb=yes][color=#1d4489]AA1.jpg[/color][/url] (131.1 KB) 2008-8-1 22:57
相关截图
[img]http://www.hackerxfiles.net/att_files/month_0808/20080801_2e48609922d6704d43cfoLDrDM7HGfLP.jpg[/img]
[img]http://www.hackerxfiles.net/images/attachicons/image.gif[/img] [url=http://www.hackerxfiles.net/attachment.php?aid=19867&nothumb=yes][color=#1d4489]AA2.jpg[/color][/url] (121.52 KB) 2008-8-1 22:57
相关截图
[img]http://www.hackerxfiles.net/att_files/month_0808/20080801_93451761c8763e33a6deRMEOW0eotWGU.jpg[/img]



[/td][/tr][tr][td][url=http://www.hackerxfiles.net/space.php?action=viewpro&uid=194875]查看详细资料[/url]

[/td][td][url=http://www.hackerxfiles.net/post.php?action=edit&fid=5&tid=114177&pid=863027&page=1&extra=page%3D1][color=#1d4489]编辑[/color][/url] [url=http://www.hackerxfiles.net/post.php?action=reply&fid=5&tid=114177&repquote=863027&extra=page%3D1&page=1][color=#1d4489]引用[/color][/url] [url=http://www.hackerxfiles.net/misc.php?action=report&fid=5&tid=114177&pid=863027&page=1][color=#1d4489]报告[/color][/url] [url=http://www.hackerxfiles.net/thread-114177-1-1.html###][color=#1d4489]回复[/color][/url] TOP

[/td][/tr][/table]

凋零-晴天 发表于 2008-8-1 23:44

求助啊

紧急求助

葬云 发表于 2008-8-1 23:47

1.没买7月的书
2.你的代码不清楚
3.机子上没装VB

SO,没法帮你......

零落wolf 发表于 2008-8-2 00:22

看 不懂    你 是不是  弄 错了   啊  ::01:: ::18:: ::16:: ::16::

编程小猪 发表于 2008-8-2 00:50

我也没买书,且上WAP看不到图,建议你从Form2的Form_Load下断点,逐语句运行,跟踪到出错的地方。
代码不错,但有的地方需注意,form1如果什么都不做,最好把代码写到模块中,读注册表尽量用API函数,Left去掉的不是空格。

凋零-晴天 发表于 2008-8-2 07:46

错误是在FORM2 的4、6行

凋零-晴天 发表于 2008-8-2 07:47

我是菜鸟
不太会弄

编程小猪 发表于 2008-8-2 12:33

我现在没VB环境,我觉得下面这四行有问题,先注释了看下,其中三个属性没见过,另外,Move方法的参数好像也不能只传一个。
vistaform1.frmCaption = "QQ登陆器 "

vistaform1.Captionlen = 120 '80是1个字,200是10个字 80-200
vistaform1.Move -1000 '移动vista控件到左边,以免影响美观
vistaform1.Captioncolor = &HFF9ACD32 '字体颜色

Deroemon 发表于 2008-8-2 12:44

Deroemon

同意小猪的看法:face13 :face13

凋零-晴天 发表于 2008-8-2 16:16

[quote]原帖由 [i]凋零-晴天[/i] 于 2008-8-2 07:47 发表 [url=http://www.hackerxfiles.net/redirect.php?goto=findpost&pid=863172&ptid=114178][img]http://www.hackerxfiles.net/images/common/back.gif[/img][/url]
我是菜鸟
不太会弄 [/quote]
这几个是VISTA界面,借了VISTA模块

Winnip 发表于 2008-8-2 18:43

一般我认为是不是窗体的名字不对???
vistaform1。==Form1?

金其 发表于 2008-8-2 19:53

不知道加载了vistaform控件没有::08:: ::08:: ::08::

页: [1]


Powered by Discuz! 6.1.0  © 2001-2007 Comsenz Inc.