if (!RegisterClass (&wndclass))
{
MessageBox ( NULL, TEXT ("This program requires Windows NT!"),
szAppName, MB_OK) ;
return 0 ;
}
hwnd = CreateWindow( szAppName, // window class name
TEXT ("The Hello Program"), // window caption
WS_OVERLAPPEDWINDOW, // window style
CW_USEDEFAULT,// initial x position
CW_USEDEFAULT,// initial y position
CW_USEDEFAULT,// initial x size
CW_USEDEFAULT,// initial y size
NULL, // parent window handle
NULL, // window menu handle
hInstance, // program instance handle
NULL) ; // creation parameters
LRESULT CALLBACK WndProc (HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam)
{
/* static*/ WPARAM hmsg;
HDC hdc ;
PAINTSTRUCT ps ;
RECT rect ;
switch (message)
{
case WM_LBUTTONDOWN:
MessageBox ( NULL, TEXT ("一级左键!"),
TEXT ("This program !"), MB_OK) ;
//SendMessage(hwnd,WM_RBUTTONDOWN,0,0);
return 0 ;
// switch(hmsg.message)
//{
case WM_KEYDOWN:
hmsg = mymessage(hwnd);
MessageBox ( NULL, TEXT ("This program 二级键UP!"),
TEXT ("This program !"), MB_ICONERROR) ;
switch(hmsg)
{
case VK_HOME:
MessageBox ( NULL, TEXT ("This is home键!"),
TEXT ("This program !"), MB_ICONERROR) ;
break ;
case VK_NUMLOCK:
MessageBox ( NULL, TEXT ("This is NUMLOCK键!"),
TEXT ("This program !"), MB_ICONERROR) ;
break ;
}
return 0 ;
case WM_RBUTTONDOWN:
MessageBox ( NULL, TEXT ("This program RRRRRR!"),
TEXT ("This program !"), MB_ICONERROR) ;
SendMessage(hwnd,WM_KEYDOWN,0,0);
SendMessage(hwnd,WM_CHAR,VK_HOME,0);
SendMessage(hwnd,WM_KEYUP,0,0);
return 0 ;
case WM_CREATE:
//PlaySound (TEXT ("hellowin.wav"), NULL, SND_FILENAME | SND_ASYNC) ;