receiveunit.pas
来自「《Delphi7经典问题解析》源代码」· PAS 代码 · 共 53 行
PAS
53 行
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 + =
减小字号Ctrl + -
显示快捷键?