You can use objects - you just have to control the object allocation -
that is the purpose of the "NewInstance" and "FreeInstance" methods as
defined on TObject.

 

Myles.

 

From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]
On Behalf Of Ross Levis
Sent: Wednesday, 9 May 2007 02:24
To: 'NZ Borland Developers Group - Delphi List'
Subject: RE: [DUG] Sending data between process on same computer on
windows

 

I guess you've read the readme.txt which explains all the properties and
methods.  Install it as a component.  Drop the component on a form in 2
programs.

 

I use a record pointer to share.  Here is a small example.  My record
actually contains many more fields.

 

type

  TShareRec = record

    Command: Integer;

    Filename: String[255];

  End;

  PShareRec = ^TShareRec;  

 

Var

  ShareRec: PShareRec;

Begin

  SharedMemory.ShareName := 'Something';

  SharedMemory.Size := Sizeof(TShareRec);

  If not SharedMemory.OpenMemory then

    SharedMemory.CreateMemory;

  ShareRec := SharedMemory.MapMemory;  

 

The above will work in both apps.  You can then assign ShareRec.Command
:= 1; for example, and the other app can see it instantly.

 

Be sure to UnmapMemory and CloseMemory when closing.

 

Don't use pointer types such as dynamic Strings or classes as they will
not work. 

 

Cheers,

Ross.

 

From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]
On Behalf Of Jason Coley
Sent: Wednesday, 9 May 2007 13:51
To: NZ Borland Developers Group - Delphi List
Subject: RE: [DUG] Sending data between process on same computer on
windows

 

Do you have any samples on how to work this component, I can't find much
on the net about it either, apart from download links.

 

Jason

         

        I would use shared memory.  I use this free component.

        
http://www.torry.net/vcl/system/appscommunications/sharedmemory.zip

         

        It uses a memory mapped file system but without a physical file.
It can use messages for triggering events at each end, but I actually
use a variable in a record which I check in a 10ms loop to know when to
do something.  It works very well.

         

        Ross.



Attention:
This communication is confidential and may be legally privileged.  If you are 
not the intended recipient, please do not use, disclose, copy or distribute it, 
other than to return it to us with your confirmation that it has been deleted 
from your system.
_______________________________________________
NZ Borland Developers Group - Delphi mailing list
Post: delphi@delphi.org.nz
Admin: http://delphi.org.nz/mailman/listinfo/delphi
Unsubscribe: send an email to [EMAIL PROTECTED] with Subject: unsubscribe

Reply via email to