Recent

Author Topic: Cross plataform GetVersionEx  (Read 10342 times)

clauslack

  • Sr. Member
  • ****
  • Posts: 275
Cross plataform GetVersionEx
« on: November 16, 2010, 05:54:06 pm »
There some Cross plataform GetVersionEx for detect
the operating system ?

Ej: return Windows 2000, Windows 7, Linux, etc

Thanks

Johnny5

  • Newbie
  • Posts: 6
Re: Cross plataform GetVersionEx
« Reply #1 on: November 16, 2010, 08:57:24 pm »
This certainly could help.
I'm in...
Will check on this issue...

captian jaster

  • Guest
Re: Cross plataform GetVersionEx
« Reply #2 on: November 17, 2010, 12:58:16 am »
I never had much experience with it but can't you use "IFDEF" I guess :\

Code: Pascal  [Select][+][-]
  1. program Project1;
  2.  
  3. {$mode objfpc}{$H+}
  4.  
  5. uses
  6.   Classes,SysUtils;
  7.  
  8. Const
  9.  {$IFDEF unix}
  10.  OS = 'UNIX';
  11.  {$ELSE}
  12.  OS = 'Other';
  13.  {$ENDIF}
  14.  
  15. begin
  16.   Writeln(OS);
  17.   Readln;
  18. end.
  19.          
  20.  

Johnny5

  • Newbie
  • Posts: 6
Re: Cross plataform GetVersionEx
« Reply #3 on: November 17, 2010, 01:08:53 am »
Yes but I think we are looking for a simple way to check the executable file information, ex. to get it's version info.

clauslack

  • Sr. Member
  • ****
  • Posts: 275
Re: Cross plataform GetVersionEx
« Reply #4 on: November 17, 2010, 01:36:16 am »
@Johnny5
I search for GetVersionEx Function
(Retrieves information about the current operating system.)

You say GetFileVersionInfo Function ?
Retrieves version information for the specified file.

check this
http://www.lazarus.freepascal.org/index.php/topic,5255.0.html

and
Lazarus use svn2revisioninc (creates an include file with the svn revision number ) for save the svn version. I think that this is cross plataform.
In the About Dialog show the current SVN version of the Lazarus sources.
Look at
lazarus\ide\AboutFrm.pas
lazarus\tools\svn2revisioninc.lpi
etc, etc  


@captain jaster: maybe work fine for linux your example, for Windows, I use GetVersionEx. For linux I can search for uname -a, etc, etc

Regards

« Last Edit: November 17, 2010, 01:38:26 am by clauslack »

Johnny5

  • Newbie
  • Posts: 6
Re: Cross plataform GetVersionEx
« Reply #5 on: November 17, 2010, 01:49:19 am »
Yes thanks a lot.
This will help.
But for me, in Delphi at least I built a function to retrieve the executables version info.
This way, my about Dialog Box hardly needs to be changed (if not at all).
Would there be a way to get to this resource information under linux?

marcov

  • Administrator
  • Hero Member
  • *
  • Posts: 11445
  • FPC developer.
Re: Cross plataform GetVersionEx
« Reply #6 on: November 17, 2010, 09:51:48 am »
Yes thanks a lot.
This will help.
But for me, in Delphi at least I built a function to retrieve the executables version info.
This way, my about Dialog Box hardly needs to be changed (if not at all).
Would there be a way to get to this resource information under linux?

See Baseunix.fpuname

clauslack

  • Sr. Member
  • ****
  • Posts: 275
Re: Cross plataform GetVersionEx
« Reply #7 on: November 17, 2010, 10:32:17 am »
Thanks
Baseunix.fpuname works fine.

Johnny5

  • Newbie
  • Posts: 6
Re: Cross plataform GetVersionEx
« Reply #8 on: November 17, 2010, 08:31:37 pm »
I think I have found a portion of what I was looking for.
Question for me was how can I read the current executed programs version information?
Is this part of the response?
http://wiki.lazarus.freepascal.org/Lazarus_Resources

Johnny5

  • Newbie
  • Posts: 6
Re: Cross plataform GetVersionEx
« Reply #9 on: November 17, 2010, 08:34:22 pm »
I think I have found a portion of what I was looking for.
Question for me was how can I read the current executed programs version information?
Is this part of the response?
http://wiki.lazarus.freepascal.org/Lazarus_Resources

And also this
http://lazarus.freepascal.org/index.php/topic,11052.0.html

 

TinyPortal © 2005-2018