代码如下
# include <windows.h>
# include <stdlib.h>
# include <string.h>
char str1[]="you have input up key";
char str3[]="you have input control key";
char str4[]="you have input shift key";
char str5[]="you have input cotrol a key";
char str6[]="you have input shift b key";
bool nUpKeyDown,nCtrlKeyDown,nShiftKeyDown,nCtrlAkeyDown,nShiftBKeyDwon;
LRESULT CALLBACK Winsunproc(
       HWND hwnd,      
       UINT uMsg,      
       WPARAM wParam,  
       LPARAM lParam   
);
int WINAPI WinMain(
  HINSTANCE hInstance,      
  HINSTANCE hPrevInstance,  
  LPSTR lpCmdLine,          
  int nCmdShow              
)
{
  HWND hwnd;
  MSG msg;
  WNDCLASS wndclass1;
  wndclass1.lpfnWndProc=Winsunproc;
  wndclass1.style=0;
  wndclass1.cbClsExtra=0;
  wndclass1.cbWndExtra=0;
  wndclass1.hInstance=hInstance;
  wndclass1.hCursor=LoadCursor(NULL,IDC_ARROW);
  wndclass1.hIcon=LoadIcon(NULL,IDI_ERROR);
  wndclass1.hbrBackground=(HBRUSH)GetStockObject(WHITE_BRUSH);
  wndclass1.lpszMenuName="大爷";
  wndclass1.lpszClassName="杂碎";
  if(!RegisterClass(&wndclass1))
  {
  MessageBeep(0); return FALSE;
  }  
  hwnd=CreateWindow("杂碎","大爷",WS_OVERLAPPEDWINDOW,0,0,600,400, NULL,NULL,hInstance,NULL);
  ShowWindow(hwnd,nCmdShow);
  UpdateWindow(hwnd);   while(GetMessage(&msg,NULL,0,0))
{
TranslateMessage(&msg);
DispatchMessage(&msg); 
}
}LRESULT CALLBACK Winsunproc(
  HWND hwnd,      
  UINT uMsg,      
  WPARAM wParam,  
  LPARAM lParam   
  )

bool nUpKeyDown,nCtrlkeyDown,nShiftKeyDown,nCtrlAkeyDown,nShiftBKeyDwon;
HDC hdc;
PAINTSTRUCT ps;
HPEN hpen;
HBRUSH hbrush;
switch(uMsg)
{
case WM_KEYDOWN:
{switch(wParam)
{
    case VK_UP:
    nUpKeyDown=true; 
    break;
    case VK_CONTROL:
    nCtrlKeyDown=true;
    break;
    case VK_SHIFT:
    nShiftKeyDown=true;
    break;
    default:
    break;
}
}
case WM_KEYUP:
InvalidateRect(hwnd,NULL,FALSE);
case  WM_CHAR:
if(wParam=(65&VK_CONTROL))
{
if(nCtrlkeyDown=true)
    {nCtrlAKeyDown=true;
    nCtrlkeyDown=false;
    nCtrlAKeydOWN=false;}}
if(wParam=98 | wParam=66)
{ if(nShiftKeyDown=true)
   nShiftBKeyDwon=true;
   nShiftKeyDown=false;
   break;
}
case WM_PAINT;
{
hdc=BeginPaint(hwnd,&ps);
hpen=(HPEN)GetStockObject(WHITE_PEN);
hbrush=(HBRUSH)GetStockObject(WHITE_BRUSH);
SelectObject(hdc,hpen);
SelectObject(hdc,hbrush);
SetTextColor(hdc,RGB(255,0,255));
if(nUpKeyDown==true)
{Rectangle(hdc,0,0,600,400);
TextOut(hdc,0,0,str1,strlen(str1));
nUpKeyDown=false;
if(nCtrlKeyDown==true&&nCtrlAkeyDown=false)
{
Rectangle(hdc,0,0,600,400);
TextOut(hdc,0,0,str3,strlen(str3));
nCtelKeyDown=false;
nCtrlAkeyDown=false;
}
if(nShiftKeyDown==true&&nShiftBKeyDwon=false)
{
Rectangle(hdc,0,0,600,400);
TextOut(hdc,0,0,str4,strlen(str4));
nShiftKeyDown=false;
nShiftBKeyDwon=false;
}
if(nCtrlAkeyDown==true)
{
Rectangle(hdc,0,0,600,400);
TextOut(hdc,0,0,str5,strlen(str5));
nCtrlAkeyDown=true;
}
if(nShiftBKeyDwon==true)
{
Rectangle(hdc,0,0,600,400);
TextOut(hdc,0,0,str6,strlen(str6));
nShiftBKeyDwon=false;
}
DeleteObject(hbrush);
DeleteObject(hpen);
EndPaint(hwnd,&ps);
break;
}
case WM_DESTROY:
PostQuitMessage(0);
return 0;
default:
return(DefWindowProc(hwnd,uMsg,wParam,lParam));
}
return 0;
}
: error C2065: 'nCtrlAKeyDown' : undeclared identifier
: error C2065: 'nCtrlAKeydOWN' : undeclared identifier
: error C2106: '=' : left operand must be l-value
: error C2143: syntax error : missing ':' before ';'
: error C2106: '=' : left operand must be l-value
 : error C2065: 'nCtelKeyDown' : undeclared identifier
D: error C2106: '=' : left operand must be l-value
: fatal error C1004: unexpected end of file found