realbasic-nug.fr
[Top] [All Lists]

Re: Vérifier l'os

To: REALbasic NUG French <realbasic-nug.fr@lists.realsoftware.com>
Subject: Re: Vérifier l'os
From: Vincent Mercey <vincent@billjobs.com>
Date: Fri, 25 Jul 2008 18:46:01 +0200
Authentication-results: mx.google.com; spf=neutral (google.com: 74.124.194.228 is neither permitted nor denied by best guess record for domain of realbasic-nug.fr-bounces@lists.realsoftware.com) smtp.mail=realbasic-nug.fr-bounces@lists.realsoftware.com
Delivered-to: listarchive@realsoftware.com
In-reply-to: <9963CB81-7731-4904-B6A4-FEB3F50E3709@mac.com>
References: <9963CB81-7731-4904-B6A4-FEB3F50E3709@mac.com>
Reply-to: REALbasic NUG French <realbasic-nug.fr@lists.realsoftware.com>
Sender: realbasic-nug.fr-bounces@lists.realsoftware.com

Le 25 juil. 08 à 18:37, Sébastien Debiève a écrit :

Bonjour,

Je cherche le code qui permet de faire vérifier quel système à l'utilisateur.

Voilà ce que je veux faire =
si c'est supérieur à mac os 10.4 = lancé une action

j'ai cherché, mais je n'ai pas trouvé ou peut-être que je n'ai pas mis le mot-clé correct ?

Ceci devrai faire l'affaire
(en tout cas une base pour faire mieux)

Protected Function SystemeQui() As string
  #if targetWin32
return WINSystem() 'Peut être 'Windows 2000, Windows 98, Windows XP, Windows NT
  #else
    Dim b as boolean
    dim n as integer
    b = system.gestalt("sysv",n)
    return "Mac "+hex(n) 'Peut être 'Mac 1034, Mac 1028 etc....
  #endif
End Function



Protected Function WINSystem() As string
  #if targetwin32 then
    dim m As MemoryBlock
    dim n as Integer

Declare Function GetVersionEx Lib "kernel32.dll" Alias "GetVersionExA" (lpVersionInformation as Ptr) As Integer
    m = newMemoryBlock(256)
    m.Long(0) = 148
    n = GetVersionEx(m)

    if m.Long(16) = 1 then
      if m.Long(4) = 4 and m.Long(8) = 10 then
        return "Windows 98"
      end if
      return "Windows 95"

    elseif m.Long(16) = 2 then
      if m.Long(4) = 5 and m.Long(8) = 1 then
        return "Windows XP"
      elseif m.Long(4) = 5 and m.Long(8) = 0 then
        return "Windows 2000"
      end if
      return "Windows NT"
    end if
  #endif
End Function




Sincères salutations
----------------------------
Vincent MERCEY
http://www.billjobs.com





<Prev in Thread] Current Thread [Next in Thread>