Receiveunit.pas
上传用户:psxgmh
上传日期:2013-04-08
资源大小:15112k
文件大小:1k
- 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.