DanieleC88
27-09-2003, 16:58
Non so se sono l'unico, ma non capisco le API di Windows. La guida mi dice che impostando TimerProc su NULL Windows manda un messaggio WM_TIMER alla finestra. Questo non mi succede usando
case WM_CREATE:
timerid = SetTimer (hwnd, IDTIMER, TIMDLAY, (TIMERPROC) NULL);
if ( timerid == 0)
MessageBox (hwnd, "No timer available.", "Error", MB_ICONINFORMATION);
break;
case WM_TIMER:
BYTE *keystate;
GetKeyboardState (keystate);
if ( keystate[VK_DOWN ] ) plane.y += movement;
if ( keystate[VK_UP ] ) plane.y -= movement;
if ( keystate[VK_RIGHT] ) plane.x += movement;
if ( keystate[VK_LEFT ] ) plane.x -= movement;
keystate = NULL;
Redraw ();
break;
Nella WndProc uso SetTimer con WM_CREATE e non ho alcun errore, ma le chiamate a WM_TIMER che Windows promette non ci sono.
case WM_CREATE:
timerid = SetTimer (hwnd, IDTIMER, TIMDLAY, (TIMERPROC) NULL);
if ( timerid == 0)
MessageBox (hwnd, "No timer available.", "Error", MB_ICONINFORMATION);
break;
case WM_TIMER:
BYTE *keystate;
GetKeyboardState (keystate);
if ( keystate[VK_DOWN ] ) plane.y += movement;
if ( keystate[VK_UP ] ) plane.y -= movement;
if ( keystate[VK_RIGHT] ) plane.x += movement;
if ( keystate[VK_LEFT ] ) plane.x -= movement;
keystate = NULL;
Redraw ();
break;
Nella WndProc uso SetTimer con WM_CREATE e non ho alcun errore, ma le chiamate a WM_TIMER che Windows promette non ci sono.