>loForm = CREATEOBJECT("Form1") >loForm.Show() >READ EVENTS > >DEFINE CLASS Form1 AS form > Caption = "Form1" > AutoCenter = .T. > KeyPreview = .T. > Name = "Form1" > > ADD OBJECT label1 AS label WITH ; > AutoSize = .T., ; > BackStyle = 0, ; > Caption = "Shift-Alt-Ctrl:", ; > Height = 17, ; > Left = 12, ; > Top = 36, ; > Width = 69, ; > Name = "Label1" > > ADD OBJECT label2 AS label WITH ; > AutoSize = .T., ; > BackStyle = 0, ; > Caption = "KeyCode:", ; > Height = 17, ; > Left = 12, ; > Top = 72, ; > Width = 55, ; > Name = "Label2" > > ADD OBJECT text1 AS textbox WITH ; > Height = 23, ; > Left = 96, ; > TabIndex = 2, ; > Top = 36, ; > Width = 100, ; > Name = "Text1" > > ADD OBJECT text2 AS textbox WITH ; > Height = 23, ; > Left = 96, ; > TabIndex = 3, ; > Top = 72, ; > Width = 100, ; > Name = "Text2" > > ADD OBJECT command1 AS commandbutton WITH ; > Top = 204, ; > Left = 276, ; > Height = 27, ; > Width = 84, ; > Caption = "Command1", ; > TabIndex = 1, ; > Name = "Command1" > > ADD OBJECT timer1 AS timer WITH ; > Top = 0, ; > Left = 0, ; > Height = 23, ; > Width = 23, ; > Interval = 50, ; > Name = "Timer1" > > PROCEDURE Destroy > CLEAR EVENTS > ENDPROC > > PROCEDURE KeyPress > LPARAMETERS nKeyCode, nShiftAltCtrl > IF nShiftAltCtrl = 2 AND BETWEEN(nKeyCode, 48, 57) > this.Text1.Value = nShiftAltCtrl > this.Text2.Value = nKeyCode > ELSE > this.Text1.Value = 0 > this.Text2.Value = 0 > ENDIF > ENDPROC > > PROCEDURE timer1.Init > DECLARE LONG GetAsyncKeyState IN WIN32API LONG > ENDPROC > > PROCEDURE timer1.Timer > this.Enabled = .F. > #define VK_CONTROL 0x11 > IF BITAND(GetAsyncKeyState(VK_CONTROL), 0x8000) != 0 > FOR m.i = 48 TO 57 > IF BITAND(GetAsyncKeyState(m.i), 0x8000) != 0 > RAISEEVENT(thisform, "KeyPress", m.i, 2) > EXIT > ENDIF > ENDFOR > ENDIF > this.Enabled = .T. > ENDPROC >ENDDEFINE >>