FastMM4 - Help with shared memory ?
- From: Pierre Y. <pierre.y@xxxxxxxxx>
- Date: Mon, 27 Nov 2006 16:25:42 +0100
Hi all,
I have to write something to help third party vendors to send strings to my application.
What I thought was to write a simple DLL that shares Memory with my application. Third parties just have to load the DLL and call the "PainlessSendAStringToPierreApplication(What: PChar)"
I just have to remember my MainForm Handle to send it messages.
Host Application :
LoadLibrary('SendAStringToPierre.dll');
GetProcAddress(dllHandle, 'InitLibrary')
InitLibrary(Self.Handle)
DLL :
InitLibrary(Hnd: THandle)
begin
[shared] HostHandle := HostHandle; // here
end
PainlessSendAStringToPierreApplication(What: PChar) : Boolean; stdcall;
begin
if [shared] HostHandle = 0 then
Result := false
else
begin
Atom = GlobalAddAtom(What);
Result := SendMessage([shared] HostHandle,
WM_PIERREMESSAGE, Atom, 0) <> 0;
GlobalDeleteAtom(Atom);
end;
end;
Third Party Application :
LoadLibrary('SendAStringToPierre.dll');
GetProcAddress(dllHandle, 'PainlessSendAStringToPierreApplication')
PainlessSendAStringToPierreApplication(PChar('Hello Pierre !'));
Can FastMM help me to share this memory or do I have to create shared memory using CreateFileMapping/MapViewOfFile ?
.... or do you have better ideas to achieve this ?
Best Regards,
--
Pierre Y.
.
- Follow-Ups:
- Re: FastMM4 - Help with shared memory ?
- From: Bob Gonder
- Re: FastMM4 - Help with shared memory ?
- From: Bart van der Werf
- Re: FastMM4 - Help with shared memory ?
- Prev by Date: Re: Fastcode CharPosRev B&V 0.6.2
- Next by Date: Re: Fastcode CharPosRev B&V 0.6.0
- Previous by thread: Fastcode SpreadsheetCreator 0.9.9
- Next by thread: Re: FastMM4 - Help with shared memory ?
- Index(es):