Everyone, thanks for the help so far.  I should have been clearer in my original post, the code sample is just an excerpt showing the heart of the problem.  The full code is shown below.  It fails with the error I have been talking about, InitKeyboard() has been executed successfully.  This program is a working example provided by PB.   Any ideas? 
If InitKeyboard() = 0
  MessageRequester("Error", "Can't open DirectX 7", 0)
  End
EndIf
If InitSprite() = 0
  MessageRequester("Error", "Can't open DirectX 7", 0)
  End
EndIf
MessageRequester("Information", "This will test the fast keyboard access..."+Chr(10)+"Press 'ESC' to quit!", 0)
If OpenScreen(640, 480, 16, "Sprite")
  x = 100
  y = 100
  
  If LoadSprite(0, "data/Player_1.bmp", 0) = 0
    CloseScreen()
    MessageRequester("PureBasic", "Can't load the sprite file (data/Player_1.bmp)", 0)
    End
  EndIf
  Repeat
  
    FlipBuffers()
    ClearScreen(0,0,0)
    
    ExamineKeyboard()
    
    If KeyboardPushed(#PB_Key_Left)
      x-1
    EndIf
  
    If KeyboardPushed(#PB_Key_Right)
      x+1
    EndIf
  
    If KeyboardPushed(#PB_Key_Up)
      y-1
    EndIf
  
    If KeyboardPushed(#PB_Key_Down)
      y+1
    EndIf
    
    DisplaySprite(0, x, y)
    
  Until KeyboardPushed(#PB_Key_Escape)
Else
  MessageRequester("Error", "Impossible to open a 680*480 16 bit screen",0)
EndIf
End 
  
