newtofoxpro
Programmer
Code:
PUBLIC ofrm
ofrm = CREATEOBJECT("MyForm")
ofrm.show(1)
RETURN
DEFINE CLASS MyForm as Form
AutoCenter=.T.
ADD OBJECT txt1 as textbox
ADD OBJECT txt2 as textbox WITH Top=50
ADD OBJECT cmd as commandbutton WITH top = 100, Height=100, Width=thisform.width, Visible=.F.
PROCEDURE Init
DECLARE integer GetKeyState IN User32 integer
BINDEVENT(This.HWnd,0x0100,This,"DetectCtrlKeyDn")
BINDEVENT(This.HWnd,0x0101,This,"DetectCtrlKeyUp")
BINDEVENT(This.HWnd,0x0104,This,"DetectAltKeyDn")
BINDEVENT(This.HWnd,0x0105,This,"DetectAltKeyUp")
ENDPROC
PROCEDURE DetectCtrlKeyDn(p1,p2,p3,p4)
IF bittest(GetKeyState(0x11),7)
this.cmd.Caption="Ctrl"
this.cmd.Visible=.T.
ENDIF
PROCEDURE DetectCtrlKeyUp(p1,p2,p3,p4)
this.cmd.Visible=.F.
PROCEDURE DetectAltKeyDn(p1,p2,p3,p4)
this.cmd.Caption="Alt"
this.cmd.Visible=.T.
PROCEDURE DetectAltKeyUp(p1,p2,p3,p4)
this.cmd.Visible=.F.
ENDDEFINE
1. If I press F10 Alt key works. I need only Alt key should work.
2. Arrow keys not working. I need only Ctrl key should work.
What I am missing ? Please help me.
Best Regards.