📄 sendunit.pas
字号:
unit sendunit;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, StdCtrls, Buttons;
type
TForm1 = class(TForm)
Edit1: TEdit;
Label1: TLabel;
BitBtn1: TBitBtn;
procedure BitBtn1Click(Sender: TObject);
procedure FormCreate(Sender: TObject);
procedure FormClose(Sender: TObject; var Action: TCloseAction);
private
{ Private declarations }
public
procedure SendData;
{ Public declarations }
end;
var
Form1: TForm1;
MapFilehWnd: THandle;
MapFilePointer: Pointer;
implementation
{$R *.dfm}
procedure TForm1.SendData; //发送消息和数据过程
begin
MapFilehWnd := CreateFileMapping ($FFFFFFFF,nil,page_ReadWrite, 0,10000,'MapFileDemo');
if MapFilehWnd <> 0 then
begin
MapFilePointer := MapViewOfFile (MapFilehWnd ,FILE_MAP_ALL_ACCESS,0, 0, 0);
StrCopy(PChar(MapFilePointer),PChar (Edit1.Text));
end;
end;
procedure TForm1.BitBtn1Click(Sender: TObject);
begin
if Edit1.Text<>'' then
SendData;
end;
procedure TForm1.FormCreate(Sender: TObject);
begin
MapFilehWnd:=0;
MapFilePointer:=Nil;
end;
procedure TForm1.FormClose(Sender: TObject; var Action: TCloseAction);
begin
if MapFilePointer<>Nil then
begin
UnmapViewOfFile(MapFilePointer);
CloseHandle(MapFilehWnd);
end;
end;
end.
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -