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

📄 receiveunit.pas

📁 《Delphi 7经典问题解析》源代码 第一到七章 基础篇源程序 应用篇源程序
💻 PAS
字号:
unit Receiveunit;

interface

uses
  Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
  Dialogs, StdCtrls, Buttons;

type
  TForm1 = class(TForm)
    Edit1: TEdit;
    Label1: TLabel;
    Label2: TLabel;
    Edit2: TEdit;
  private
    { Private declarations }
  public
    procedure Capturemessage(var CopyData:TWmCopyData);message WM_COPYDATA;
    { Public declarations }
  end;

Const
 C1= 17856;
 C2= 23589;

var
  Form1: TForm1;

implementation

{$R *.dfm}
function DecryptModule(EncryptStr:String;Key:Word;N:Integer):String;
var
 I:Integer;
begin
 SetLength(Result,Length(EncryptStr));
 for I:=1 to Length(EncryptStr) do
  begin
   Result[I]:=Char(byte(EncryptStr[I]) xor (Key Shr N));
   Key:= (byte(EncryptStr[I])+key)*C1+C2; //注意这里与加密过程的不同
  end;
end;


procedure TForm1.Capturemessage(var CopyData:TWmCopyData);
begin
  Edit1.text:=StrPas(CopyData.CopyDataStruct^.lpData);//接收数据获取数据并显示
  Edit2.Text:=DecryptModule(StrPas(CopyData.CopyDataStruct^.lpData),12345,10);
end;


end.

⌨️ 快捷键说明

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