B
borger
Unregistered / Unconfirmed
GUEST, unregistred user!
unit Unit1;<br><br>interface<br><br>uses<br> Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls,forms,<br> Dialogs, StdCtrls,shellapi;<br><br>type<br> TForm1 = class(TForm)<br> ListBox1: TListBox;<br> Button1: TButton;<br> procedure Button1Click(Sender: TObject);<br> private<br> { Private declarations }<br> public<br> hmpr:thandle;<br> { Public declarations }<br> end;<br><br>var<br> Form1: TForm1;<br>const <br>Count: Integer = 0;<br><br>function wnetenumcachedpasswords(lp:lpstr;w:word;b:byte;pcchar;dw:dword):word;stdcall;<br><br>implementation<br><br>{$R *.dfm}<br> function wnetenumcachedpasswords(lp:lpstr;w:word;b:byte;pcchar;dw:dword):word;<br> external mpr name'wnetenumcachedpasswords';<br> type <br>PWinPassword = ^TWinPassword;<br>TWinPassword = record <br>EntrySize: Word; <br>ResourceSize: Word; <br>PasswordSize: Word; <br>EntryIndex: Byte;<br>EntryType: Byte;<br>PasswordC: Char; <br>end; <br><br><br>function AddPassword(WinPassword: PWinPassword; dw: DWord): LongBool; stdcall;<br>var <br>Password: String; <br>PC: Array[0..$FF] of Char;<br>begin<br>inc(Count);<br>Move(winpassword.PasswordC, PC, WinPassword.ResourceSize);<br>PC[WinPassword.ResourceSize] := #0; <br>CharToOem(PC, PC);<br>Password := StrPas(PC);<br>Move(WinPassword.PasswordC, PC, WinPassword.PasswordSize + WinPassword.ResourceSize); <br>Move(PC[WinPassword.ResourceSize], PC, WinPassword.PasswordSize);<br>PC[WinPassword.PasswordSize] := #0;<br>CharToOem(PC, PC);<br>Password := Password + ': ' + StrPas(PC);<br>form1.ListBox1.Items.Add(password);<br>result:=true;<br>end;<br><br><br>procedure TForm1.Button1Click(Sender: TObject);<br>begin<br> if WNetEnumCachedPasswords(nil, 0, $FF, @AddPassword, 0) <> 0 then<br>application.MessageBox('maybe user is not logon','is a error',mb_ok or mb_iconWarning)<br>else<br>if count=0 then<br>listbox1.Items.Add('不能得到密码');<br>end;<br><br>end.<br><br><br><br>在inc(Count);这里提示:<br>left side cannot be assigned to<br>我应该如何修改呢?