Atom like feature in FreePascal

classic Classic list List threaded Threaded
4 messages Options
Reply | Threaded
Open this post in threaded view
|

Atom like feature in FreePascal

MAGENTA LTD
I'm interest on an OS independed (or at least Linux and MacOS), Windows
ATOM like* feature, supported by FreePascal. Most similar feature found
is environment variables which are accessed by GetEnvironmentVariable()
function. There is Get function but could not find any Create or Set.
Besides documentation, already checked osutilsh.inc file in which
GetEnvironmentVariable() is declared. I think if there was any related
functions would be stored in this same interface file, right?

What I need to do:
I need to set a system wide flag so to determine if specific tasks are
executed in current system login session. If user log off or restart,
then I could know this by not finding flags in memory. Flags should not
be visible to any other program (enumeration-proof), unless it is called
by it's name.

Any directions would be most appreciated.

* Windows atoms are like system variables which can be used as flags or
as counters. This is supported by a group of Windows API functions, such
as "GlodalAddAtom, GlobalFindAtom, GlobalDeleteAtom". Atoms cannot be
enumerated or accessed if caller do not know it's specific name. So, it
a kind of safe way to pass flags or information between programs and
instances of your apps.

Regards, Panagiotis
-------------------
OS: Linux, Knoppel, Knoppix localized distribution
IDE: Lazarus (revision 8985)
FreePascal revision: 3010

_______________________________________________
fpc-pascal maillist  -  [hidden email]
http://lists.freepascal.org/mailman/listinfo/fpc-pascal
Reply | Threaded
Open this post in threaded view
|

RE: Atom like feature in FreePascal

Jeff Pohlmeyer
> I'm interest on an OS independed (or at least Linux and MacOS),
> Windows ATOM like* feature, supported by FreePascal.

Maybe this?
http://www.xfree86.org/4.0.1/XInternAtom.3.html
_______________________________________________
fpc-pascal maillist  -  [hidden email]
http://lists.freepascal.org/mailman/listinfo/fpc-pascal
Reply | Threaded
Open this post in threaded view
|

Re: RE: Atom like feature in FreePascal

Felipe Monteiro de Carvalho
Hello,

My advice about how to support this would be creating a class that has
Atom functions and implements them separetely on each platform.

So far we saw here that winapi and X11 have Atom functions. There is
probably something equivalent for Carbon on Mac OS X, you just need to
search Apple docs.

This is a case similar to TTrayIcon, because both components need a
separete implementation based on the OS, and not really per widgetset.
I mean, let's say you use gtk on windows, you will still want to
implement Atom function using the windows api, because x11 isn't
available there. (suposing gtk doesn't have atom functions)

thanks,
--
Felipe Monteiro de Carvalho
_______________________________________________
fpc-pascal maillist  -  [hidden email]
http://lists.freepascal.org/mailman/listinfo/fpc-pascal
Reply | Threaded
Open this post in threaded view
|

RE: Atom like feature in FreePascal

MAGENTA LTD
In reply to this post by Jeff Pohlmeyer
Yes, this is what I need. ATOMS are implemented in xlib file which you
have just to include.
Here are a couple of functions to use ATOMs directly for anyone interest
in:

// if exist a specific ATOM
function spExistATOM( cAtomName: string ): boolean;
var
   cDisplay: string;
   Display: PDisplay;

begin
     cDisplay := GetEnvironmentVariable( 'DISPLAY' );
     Display := XOpenDisplay( pchar( cDisplay ) );
     if XInternAtom( Display, cAtomName, true ) > 0 then Result := true
     else Result := false;
end;

// create ATOM
function spCreateATOM( cAtomName: string ): integer;
var
   cDisplay: string;
   Display: PDisplay;

begin
     cDisplay := GetEnvironmentVariable( 'DISPLAY' );
     Display := XOpenDisplay( pchar( cDisplay ) );
     if not spExistATOM( cAtomName ) then Result := XInternAtom(
Display, ATOM_NAME, false )
     else Result := XInternAtom( Display, cAtomName, true );
end;

Regards, Pamagiotis

-----Original Message-----
From: Jeff Pohlmeyer [mailto:[hidden email]]
Sent: Friday, March 24, 2006 1:29 PM
To: [hidden email]
Cc: [hidden email]
Subject: RE: Atom like feature in FreePascal


> I'm interest on an OS independed (or at least Linux and MacOS),
> Windows ATOM like* feature, supported by FreePascal.

Maybe this?
http://www.xfree86.org/4.0.1/XInternAtom.3.html

_______________________________________________
fpc-pascal maillist  -  [hidden email]
http://lists.freepascal.org/mailman/listinfo/fpc-pascal