Ok.. I solved the problem.. I just had to include a couple of header files such as
#include <windows.h>
#include "atlbase.h"
because without them some definitions of type are missing.
Now it works fine.
Will it be useful to send a copy of the code as a project example? If anyone is interested..
Thanks anyway!
Luca