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:


mercoledì 24 gennaio 2007

Finalmente il mio blog

Finalmente mi sono deciso a pubblicare il mio blog!
Lo so che avrei dovuto farlo prima, ma tra i soliti mille impegni, il lavoro, la famiglia, lo sport, le letture ecc. mi è mancato il tempo (e forse anche un po' la volontà).
Non ho ancora un idea precisa su cosa verrà inserito in questo blog. Mi immagino certamente dei post (in italiano o in inglese) sui temi che tratto quotidianamente come l'informatica (smart card, crittografia, intelligenza artificiale, applicazioni per cellulari, programmazione ecc.) e la fisica (meccanica quantistica, computazione quantistica, ecc). Ma mi piacerebbero anche post su matematica, filosofia, letteratura e scienze.
Vedremo...
--------------
And finally my Blog!
I know, I should wrote it some years ago but by switching from my job, my family, sports, readings etc. I didn't have a bit of time (and the will) to spent on my blog.
I don't have a precise idea of what I'll publish in this blog. I imagine posts (in italian and in english) about themes I treat daily such as Informatics (
smart cards, cryptography, Artificial Intelligence, Mobile phone applications, programming and so on) and physics (Quantum Mechanics, Quantum Computation, etc.) But I hope to write also posts about mathematics, phylosophy literature, and science.
We'll see...