Writting to Shared Memory Delphi 5 code

To write shared memory into a temperature slot, you need to do 2 things

1) select "custom" as board sensor for the mbm sensor in question on the temperature tab

2) start coding your own application that puts the value in from a device like the 512 Point Temperature Meas System by Dr. Peter H Anderson (http://www.phanderson.com/), if you don't know how, then check out Roelof Engelbrecht his page at http://pages.tca.net/roelof/t2mbm/


// Below is the decleration of the types used to create the shared memory sections //

  type
    TSharedData = Record
      STemperature       : array [1..10]  of Integer;   // Holding the 10 possible temps
      SVoltage           : array [1..10]  of Real;      // Holding the 10 possible voltages
      SFan               : array [1..10]  of Integer;   // Holding the 10 possible fans
      SMHZ               : Integer;                     // CPU freq
      SNrCPU             : Byte;                        // Number of CPU's
      SCPUUsage          : array [1..4]   of Real;      // Holding the 4 possible CPU loads

    end;
  PSharedData = ^TSharedData;
// below is some sample code for writting to the shared memory section
var
  Form1  : TForm;
  hSData : Integer;
procedure FormCreate(Sender: TObject);
function WriteSharedData(ValueToWrite, SensorToWriteTo : Byte) : Boolean;

implementation
procedure TForm1.FormCreate(Sender: TObject);
begin
  hSData:=CreateFilemapping($FFFFFFFF, 0 , PAGE_READWRITE, 0, SizeOf(TSharedData),'$M$B$M$5$D$');
end;
function TForm1.WriteSharedData(ValueToWrite, SensorToWriteTo : Byte) : Boolean;
var
  PSH          : PSharedData;
begin
  Result:=False;
  if hSData=0 then Exit;
  PSH:=MapViewOfFile(hSData, FILE_MAP_WRITE, 0,0,0);  
  if PSH=Nil then Exit;
  with PSH^ do 
  begin
    STemperature[SensorToWriteTo]:=ValueToWrite;
  end;
  UnmapViewOfFile(PSH);
  Result:=True;
end;