W
ww990
Unregistered / Unconfirmed
GUEST, unregistred user!
代码如下:
type
Thandle = Integer;
TSetShareData = procedure(value: integer); stdcall;
procedure TForm1.btn1Click(Sender: TObject);
var
temp: Integer;
handle:Thandle;
SetShareData : TSetShareData ;
begin
temp:=StrToInt(edt1.Text);
handle:=loadlibrary('DLLMem.dll');
if handle <> 0 then
try
@SetShareData:=GetProcAddress(handle,'SetShareData');
if @SetShareData <> nil then
SetShareData(temp);
finally
FreeLibrary(handle);
end else
ShowMessage('未找到动态链接库DLLMem.dll');
end;
说明一下:静态加载dll则可以将数值写入共享内存。
type
Thandle = Integer;
TSetShareData = procedure(value: integer); stdcall;
procedure TForm1.btn1Click(Sender: TObject);
var
temp: Integer;
handle:Thandle;
SetShareData : TSetShareData ;
begin
temp:=StrToInt(edt1.Text);
handle:=loadlibrary('DLLMem.dll');
if handle <> 0 then
try
@SetShareData:=GetProcAddress(handle,'SetShareData');
if @SetShareData <> nil then
SetShareData(temp);
finally
FreeLibrary(handle);
end else
ShowMessage('未找到动态链接库DLLMem.dll');
end;
说明一下:静态加载dll则可以将数值写入共享内存。