W
wp231957
Unregistered / Unconfirmed
GUEST, unregistred user!
unit Unit1;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, StdCtrls;
type
TForm1 = class(TForm)
Button1: TButton;
Button2: TButton;
Button3: TButton;
Edit1: TEdit;
Label1: TLabel;
procedure Button2Click(Sender: TObject);
procedure Button3Click(Sender: TObject);
procedure Button1Click(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
var
Form1: TForm1;
maphandle:thandle;
implementation
{$R *.dfm}
procedure TForm1.Button2Click(Sender: TObject);
var
lsize:integer;
pviewointer;
begin
lsize:=4*1024;
maphandle:=createfilemapping(dword($ffffffff),nil,PAGE_READWRITE,0,lsize,pchar('smapname'));
if maphandle=0 then exit;
if getlasterror()=error_already_exists then begin
showmessage('MAPÒѾ­´æÔÚ');
closehandle(maphandle);
exit;
end;
pview:=mapviewoffile(maphandle,FILE_MAP_READ OR FILE_MAP_WRITE,0,0,4096);
if pview=nil then exit;
pchar(pview):=pchar(edit1.text); //计划把EDIT.TEXT写如共享区
end;
procedure TForm1.Button3Click(Sender: TObject);
begin
closehandle(maphandle);
end;
procedure TForm1.Button1Click(Sender: TObject);
var
hfilemap:thandle;
pviewointer;
begin
hfilemap:=openfilemapping(FILE_MAP_READ OR FILE_MAP_WRITE,false,pchar('smapname'));
if hfilemap=0 then begin
showmessage('not found map');
exit;
end;
pview:=mapviewoffile(hfilemap,FILE_MAP_READ OR FILE_MAP_WRITE,0,0,4096);
if pview=nil then exit;
edit1.Text :=pchar(pview); //从共享区读数据,可是没实现
end;
end.
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, StdCtrls;
type
TForm1 = class(TForm)
Button1: TButton;
Button2: TButton;
Button3: TButton;
Edit1: TEdit;
Label1: TLabel;
procedure Button2Click(Sender: TObject);
procedure Button3Click(Sender: TObject);
procedure Button1Click(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
var
Form1: TForm1;
maphandle:thandle;
implementation
{$R *.dfm}
procedure TForm1.Button2Click(Sender: TObject);
var
lsize:integer;
pviewointer;
begin
lsize:=4*1024;
maphandle:=createfilemapping(dword($ffffffff),nil,PAGE_READWRITE,0,lsize,pchar('smapname'));
if maphandle=0 then exit;
if getlasterror()=error_already_exists then begin
showmessage('MAPÒѾ­´æÔÚ');
closehandle(maphandle);
exit;
end;
pview:=mapviewoffile(maphandle,FILE_MAP_READ OR FILE_MAP_WRITE,0,0,4096);
if pview=nil then exit;
pchar(pview):=pchar(edit1.text); //计划把EDIT.TEXT写如共享区
end;
procedure TForm1.Button3Click(Sender: TObject);
begin
closehandle(maphandle);
end;
procedure TForm1.Button1Click(Sender: TObject);
var
hfilemap:thandle;
pviewointer;
begin
hfilemap:=openfilemapping(FILE_MAP_READ OR FILE_MAP_WRITE,false,pchar('smapname'));
if hfilemap=0 then begin
showmessage('not found map');
exit;
end;
pview:=mapviewoffile(hfilemap,FILE_MAP_READ OR FILE_MAP_WRITE,0,0,4096);
if pview=nil then exit;
edit1.Text :=pchar(pview); //从共享区读数据,可是没实现
end;
end.