BorlandTalk.com Forum Index BorlandTalk.com
Borland discussion newsgroups
 
Archives   FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

FastMM4 - Help with shared memory ?

 
Post new topic   Reply to topic    BorlandTalk.com Forum Index -> Delphi Language BASM
View previous topic :: View next topic  
Author Message
Pierre Y.
Guest





PostPosted: Mon Nov 27, 2006 9:25 pm    Post subject: FastMM4 - Help with shared memory ? Reply with quote



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





PostPosted: Wed Nov 29, 2006 12:57 am    Post subject: Re: FastMM4 - Help with shared memory ? Reply with quote



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
Display posts from previous:   
Post new topic   Reply to topic    BorlandTalk.com Forum Index -> Delphi Language BASM All times are GMT
Page 1 of 1

 
Jump to:  
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


Powered by phpBB © 2001, 2006 phpBB Group
SEO toolkit © 2004-2006 webmedic.