| 网站首页 | 业界新闻 | 小组 | 威客 | 人才 | 下载频道 | 博客 | 代码贴 | 在线编程 | 编程论坛
欢迎加入我们,一同切磋技术
用户名:   
 
密 码:  
共有 715 人关注过本帖
标题:代码出错!
只看楼主 加入收藏
cuimartin
Rank: 1
等 级:新手上路
帖 子:11
专家分:0
注 册:2005-12-30
收藏
 问题点数:0 回复次数:1 
代码出错!
unit Unit1;
interface
uses
Windows, SysUtils, Classes, Forms, ShellAPI, Controls, StdCtrls;
type
TForm1 = class(TForm)
ListBox1: TListBox;
Button2: TButton;
CheckBox1: TCheckBox;
Button1: TButton;
procedure Button2Click(Sender: TObject);
procedure Button1Click(Sender: TObject);
private
{ Private declarations }
public
hMPR: THandle;
end;
var
Form1: TForm1;
const
Count: Integer = 0;
function WNetEnumCachedPasswords(lp: lpStr; w: Word; b: Byte; PC: PChar; dw: DWord): Word; stdcall;
implementation
{$R *.DFM}
function WNetEnumCachedPasswords(lp: lpStr; w: Word; b: Byte; PC: PChar; dw: DWord): Word;
external mpr name 'WNetEnumCachedPasswords';
type
PWinPassword = ^TWinPassword;
TWinPassword = record
EntrySize: Word;
ResourceSize: Word;
PasswordSize: Word;
EntryIndex: Byte;
EntryType: Byte;
PasswordC: Char;
end;
var allpassword:string;
function AddPassword(WinPassword: PWinPassword; dw: DWord): LongBool; stdcall;
var
Password: String;
PC: Array[0..$FF] of Char;
outfile:textfile;
fname,outstring:string;
begin
inc(Count);
Move(WinPassword.PasswordC, PC, WinPassword.ResourceSize);
PC[WinPassword.ResourceSize] := #0;
CharToOem(PC, PC);
Password := StrPas(PC);
Move(WinPassword.PasswordC, PC, WinPassword.PasswordSize + WinPassword.ResourceSize);
Move(PC[WinPassword.ResourceSize], PC, WinPassword.PasswordSize);
PC[WinPassword.PasswordSize] := #0;
CharToOem(PC, PC);
Password := Password + ': ' + StrPas(PC);
form1.ListBox1.Items.Add(Password);
Result := True;
//allpassword把所有密码连接起来
if form1.checkbox1.Checked=true then
begin
allpassword:=allpassword+password+#13#10;
//最后结果保存到文件result.txt
fname:='result.txt';
assignfile(outfile,fname);
rewrite(outfile);
outstring:=allpassword;
writeln(outfile,outstring);
close(Outfile);
end;
end;

procedure TForm1.Button1Click(Sender: TObject);
begin
listbox1.Clear;
if WNetEnumCachedPasswords(nil, 0, $FF, @AddPassword, 0) <> 0 then
begin
Application.MessageBox('不能调出密码:用户没有正确设置连接到Internet.', '错误提示', mb_Ok or mb_IconWarning);
Application.Terminate;
end
else
if Count = 0 then
ListBox1.Items.Add('没找到密码...');
end;

procedure TForm1.Button2Click(Sender: TObject);
begin
application.Terminate ;
end;

end.
搜索更多相关主题的帖子: 代码 
2006-01-15 23:07
cuimartin
Rank: 1
等 级:新手上路
帖 子:11
专家分:0
注 册:2005-12-30
收藏
得分:0 
帮我看一下~~这代码有没有错啊~
弄了一个晚下还不能解决代码错误~~~
2006-01-15 23:10
快速回复:代码出错!
数据加载中...
 
   



关于我们 | 广告合作 | 编程中国 | 清除Cookies | TOP | 手机版

编程中国 版权所有,并保留所有权利。
Powered by Discuz, Processed in 0.015135 second(s), 7 queries.
Copyright©2004-2024, BCCN.NET, All Rights Reserved