 |
BorlandTalk.com Borland discussion newsgroups
|
| View previous topic :: View next topic |
| Author |
Message |
Pierre Y. Guest
|
Posted: Mon Nov 27, 2006 9:25 pm Post subject: FastMM4 - Help with shared memory ? |
|
|
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. |
|
| Back to top |
|
 |
Bob Gonder Guest
|
Posted: Wed Nov 29, 2006 12:57 am Post subject: Re: FastMM4 - Help with shared memory ? |
|
|
Pierre Y. wrote:
| Quote: | I have to write something to help third party vendors to send strings
to my application.
|
You might also look at named pipes.
Your app could have a pipe thread blocked on the named pipe (in the
dll)
Their app would call your dll to send the string through the pipe.
(Their interface would be the same as you wrote, just the internals
are different) |
|
| Back to top |
|
 |
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|
|