I am trying to detect which keybard type was used in Windows 7 x64 and Windows 2008 R2 x64 platforms by using Visual Studio 2008 SP1 and Windows SDK v7.0. Compile and run successful but return type is always Japanese Keyboard where installed "Standard PS/2 (101/102 key)" keyboards. I wonder Where my mistake is in the following code.
Code:
#include <windows.h>
#include <iostream>
using namespace std;

typedef DWORD ( WINAPI *KEYB )( DWORD );

int main()
{
    HINSTANCE hInst;
    KEYB GKT;
    char *type = "";

    hInst = LoadLibrary( TEXT( "user32.dll" ) );

    if ( hInst != NULL )
        GKT = ( KEYB ) GetProcAddress( hInst, "GetKeyboardType" );

    if ( NULL != GKT )
    {
        switch ( ( GKT )( 0 ) )
        {
               case 0  : type = "NOT INSTALLED"; break;
               case 1  : type = "IBM PC/XT or compatible (83 key)" ; break;
               case 2  : type = "Olivetti \"ICO\" (102 key)" ; break;
               case 3  : type = "IBM PC/AT (84-key) or similar" ; break;
               case 4  : type = "Standard PS/2 (101/102 key)" ; break;
               case 5  : type = "Nokia 1050 and similar" ; break;
               case 6  : type = "Nokia 9140 and similar" ; break;
               case 7  : type = "Japanese Keyboard" ; break;
        }
        wcout << "Installed Keyboard : " << type << endl;
    }
    else
        wcout << "Error getting keyboard Type!..." << endl;

    return 0;
}