-----------------------------------------------
Main = OpenWindow(1, 0, 0, 320, 200, #PB_Window_MinimizeGadget, "My Form")
repeat
Event=WindowEvent()
If Event=256 ;Keypress detected
kk=EventwParam() ;Value of the key in ascii
EndIf
If kk=27 ;if ESC key is pressed, terminate application
End
EndIf
delay(1) ;don't take all CPU power
forever
-----------------------------------------------

