Visualizzazione dei risultati da 1 a 2 su 2
  1. #1
    Utente di HTML.it L'avatar di Xadoom
    Registrato dal
    Dec 2002
    Messaggi
    1,491
    Parecchio tempo fa (quindi non chiedermi dove) ho trovato il codice che fa proprio quello che dici tu:
    codice:
    char* getWindowsVers(){
     OSVERSIONINFOEX osvi;
     BOOL bOsVersionInfoEx;
     char *temp;
     
     ZeroMemory(&osvi, sizeof(OSVERSIONINFOEX));
       osvi.dwOSVersionInfoSize = sizeof(OSVERSIONINFOEX);
    
       if( !(bOsVersionInfoEx = GetVersionEx ((OSVERSIONINFO *) &osvi)) )
       {
          osvi.dwOSVersionInfoSize = sizeof (OSVERSIONINFO);
          if (! GetVersionEx ( (OSVERSIONINFO *) &osvi) ) 
             return FALSE;
       }
     
     switch (osvi.dwPlatformId)
       {
          // Test for the Windows NT product family.
          case VER_PLATFORM_WIN32_NT:
    
             // Test for the specific product family.
             if ( osvi.dwMajorVersion == 5 && osvi.dwMinorVersion == 2 )
                temp = "Microsoft Windows Server 2003 family";
    
             if ( osvi.dwMajorVersion == 5 && osvi.dwMinorVersion == 1 )
                temp= "Microsoft Windows XP ";
    
             if ( osvi.dwMajorVersion == 5 && osvi.dwMinorVersion == 0 )
                temp= "Microsoft Windows 2000 ";
    
             if ( osvi.dwMajorVersion <= 4 )
                temp= "Microsoft Windows NT ";
    
             // Test for specific product on Windows NT 4.0 SP6 and later.
             if( bOsVersionInfoEx )
             {
                // Test for the workstation type.
                if ( osvi.wProductType == VER_NT_WORKSTATION )
                {
                   if( osvi.dwMajorVersion == 4 )
                      lstrcat(temp,"Workstation ");
                   else if( osvi.wSuiteMask & VER_SUITE_PERSONAL )
                      lstrcat(temp,"Home Edition ");
                   else
                      lstrcat(temp,"Professional ");
                }
    
             }
    
          // Test for the Windows 95 product family.
          case VER_PLATFORM_WIN32_WINDOWS:
    
             if (osvi.dwMajorVersion == 4 && osvi.dwMinorVersion == 0)
             {
                 temp = "Microsoft Windows 95 ";
                 if ( osvi.szCSDVersion[1] == 'C' || osvi.szCSDVersion[1] == 'B' )
                    lstrcat(temp,"OSR2 " );
             } 
    
             if (osvi.dwMajorVersion == 4 && osvi.dwMinorVersion == 10)
             {
                 temp = "Microsoft Windows 98 ";
                 if ( osvi.szCSDVersion[1] == 'A' )
                    lstrcat(temp,"SE " );
             } 
    
             if (osvi.dwMajorVersion == 4 && osvi.dwMinorVersion == 90)
             {
                 temp = "Microsoft Windows ME";
             } 
             break;
    
          case VER_PLATFORM_WIN32s:
    
             temp = "Microsoft Win32s";
             break;
       }
       return temp;
    }
    Windows Xp
    [Java]
    [PHP]Notepad++
    [Fortran90-77] elf90 g77
    [C++ /WinAPI] DevC++ VisualC++

  2. #2
    Utente di HTML.it L'avatar di Xadoom
    Registrato dal
    Dec 2002
    Messaggi
    1,491
    In realtà il metodo includeva molte più particolarità (ad esempio il tipo di SP istallato) ma io le ho tagliate per ridurlo all'essenziale. Spero ti sia di aiuto.
    Windows Xp
    [Java]
    [PHP]Notepad++
    [Fortran90-77] elf90 g77
    [C++ /WinAPI] DevC++ VisualC++

Permessi di invio

  • Non puoi inserire discussioni
  • Non puoi inserire repliche
  • Non puoi inserire allegati
  • Non puoi modificare i tuoi messaggi
  •  
Powered by vBulletin® Version 4.2.1
Copyright © 2024 vBulletin Solutions, Inc. All rights reserved.