giovedì 8 marzo 2007

My application is running on Vista?

Yesterday I find an answer to the following question: my application is running on Vista or not? The following is a peice of code which gets the Windows version of the underling operating system including the latest release of Vista:

#define OS_UNKNOWN -1
#define OS_NT4 0
#define OS_2000 1
#define OS_XP 2
#define OS_2003 3
#define OS_VISTA 4

int getWinVer()
{
    OSVERSIONINFO osVerInfo;

    osVerInfo.dwOSVersionInfoSize = sizeof(OSVERSIONINFO);

    GetVersionEx(&osVerInfo);

    if(osVerInfo.dwMajorVersion == 6)
    {
        return OS_VISTA;
    }
    else if(osVerInfo.dwMajorVersion == 5)
    {
        if(osVerInfo.dwMinorVersion == 2)
        {
            return OS_2003;
        }
        else if(osVerInfo.dwMinorVersion == 1)
        {
            return OS_XP;
        }
         else if(osVerInfo.dwMinorVersion == 0)
        {
            return OS_2000;
        }
    }
    else if(osVerInfo.dwMajorVersion <= 4)
    {
        return OS_NT4;
    }
    else
    {
        return OS_UNKNOWN;
    }
}

mercoledì 7 marzo 2007

Piede al tramonto / Foot at sunset



martedì 6 marzo 2007

Umorismo Procidano

La scorsa estate ho passato qualche giorno di vacanza a Procida.
In un angolo della strada, in prossimità del porto, ho scoperto questa pillola di umorismo procidano: