Hi Chaim,
Regarding your second question - do declare in the form's Init (only once) and you can use CLEAR DLLS GetKeyState command in form's Destroy, if needed.
Instead of MouseEnter try using Click event of a button.
>Hi,
>It's very good.
>I disabled the commandcutton and I added the following code on commandbutton.mouseenter&mousemove:
>
#DEFINE VK_CONTROL 0x11
> DECLARE Long GetKeyState IN WIN32API Long vKey
> if GetKeyState(VK_CONTROL)>1
> this.Enabled=.t.
> endif
>On mousekeave I restord the disable.
>
> it's work well,
>Small problem: for enabling, the user need to press on the 'Control' before the mousee enter to the commandbutton (if not he must go out, press on the control and than again to move the mouse to the commandbutton).
>another thing, how do I clear the declare from memory?
>
>Thank you
>
>
>>See
http://www.berezniker.com/content/pages/visual-foxpro/getting-additional-info-about-pressed-keyboard-or-mouse-keys>>
>>>
>>>My client loathe messagebox with 'Are you sure...'?.
>>>
>>>Can I force the user to hold the 'CTRL'on keyboard when pressing in the command button (else he will get msgbox to do it,return) or any similar solution?
>>>
>>>Tnx
If it's not broken, fix it until it is.
My Blog