Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Global Atoms
Message
De
06/09/2004 17:21:44
Hilmar Zonneveld
Independent Consultant
Cochabamba, Bolivie
 
 
À
06/09/2004 16:56:37
Information générale
Forum:
Visual FoxPro
Catégorie:
Autre
Titre:
Divers
Thread ID:
00939784
Message ID:
00939788
Vues:
12
>Hi to all who are interested.
>
>In my search for a method that lets two apps (one is vfp, the other a delphi exe) share some information in memory, I found out that MS offers us global 'atoms'. And I found only one message here on the UT that deals with it. No one has taken notice of what this writer - Mike Gagnon - tried to learn us. Here's the link:

The word is "teach": he teaches us, we learn.

About the atoms; to be of use for the intended purpose, we have to know the following: Can the "name" store any significant amount of text? Is the name supposed to be unique? How about the number? What is the type of the "key" you pass when creating the atoms?

>Re: Prevent same program to be open multiple times on a syst Thread #923397 Message #923403
>
>This MS link is also of importance:
>http://msdn.microsoft.com/library/default.asp?url=/library/en-us/winui/WinUI/WindowsUserInterface/DataExchange/Atoms/AtomReference/AtomFunctions/GlobalDeleteAtom.asp
>
>I have been playing around with the atom functions. In one vfp app I added the atom, in another (vfp) app I successfully used the other functions, either by having available nAtom, or by using the atom name (cString).
>
>set step on
>declare integer GlobalAddAtom     in kernel32 string lpString
>declare         GlobalDeleteAtom  in kernel32 integer
>declare integer GlobalGetAtomName in kernel32 integer nAtom, string lpBuffer, integer nSize
>declare integer GlobalFindAtom    in kernel32 string lpString
>
>public nAtom
>cString = "hello"
>nAtom = GlobalAddAtom( cString )	&& the string is the 'atom name', nAtom is the 'atom'
>
>lpBuffer = replicate( chr(0), 10 )
>nSize = len( lpBuffer  )
>? GlobalGetAtomName( nAtom, @lpBuffer, @nSize ), ":", lpBuffer, "<"
>
>? GlobalFindAtom( cString ), "<"
>susp
>lOK = GlobalDeleteAtom( nAtom ) 	&& always returns 0/.t. We should test with GetLastError
>The potential is - I hope - that it can be used as a memory based alternative for info exchange, which most of us now do with the help of a file.
>
>However, I don't get the picture on how to do this. I can create an 'atom name' and retrieve an 'atom'. Furthermore, knowing the atom (better say 'atom number'?) I can retrieve the name. Knowing the name I can retrieve the number. And I can delete the atom name and number. But that's not enough, I fear.
>
>Who has an idea on how to manipulate these functions in order to let two apps communicate information?
Difference in opinions hath cost many millions of lives: for instance, whether flesh be bread, or bread be flesh; whether whistling be a vice or a virtue; whether it be better to kiss a post, or throw it into the fire... (from Gulliver's Travels)
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform