Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Reviving the Scroll Lock
Message
Information générale
Forum:
Visual FoxPro
Catégorie:
Autre
Divers
Thread ID:
00290236
Message ID:
00290279
Vues:
30
>I appreciate the reply, and have played with it for a while... Here's what I came up with...
>
>#DEFINE VK_SCROLL 0x92
>DECLARE INTEGER GetKeyboardState IN Win32API STRING @lpCodes
>lccodes = SPACE(256)
>= GetKeyboardState(@lccodes)
>
>lnSetting = ASC(SUBSTR(lccodes,vk_scroll,1))
>lnSetting = IIF(lnSetting=0,1,0)
>lccodes = SUBSTR(lccodes,1,(vk_scroll)-1) + ;
> CHR(lnSetting) + SUBSTR(lccodes,(vk_scroll)+1,LEN(lccodes))
>
>This grabs the setting, and changes it from 1>0 or 0>1 depending. My next question is this... I tried to add in a SetKeyboardState with the new lccodes, but kept receiving the message 'Too many parameters.'. I declared it the same way and tried to run it the same way as GetKeyboardState, but it failed. Am I forgetting something ?
>
>Thanks,

Hi Chris,

First, the array of bytes needs to be passed by reference to SetKeyboardState. Anyway, I just tested the following and it worked fine:
#DEFINE VK_SCROLL 0x92
DECLARE INTEGER GetKeyboardState IN Win32API;
  STRING @lpCodes
DECLARE INTEGER SetKeyboardState IN Win32API;
  STRING @lpCodes
lccodes = SPACE(256)
= GetKeyboardState(@lccodes)
* For Windows 95/98
* Toggle the scroll lock
lccodes = LEFT(lccodes, VK_SCROLL - 1) +;
  CHR(BITXOR(ASC(SUBSTR(lccodes, VK_SCROLL, 1)), 1))+;
  SUBSTR(lccodes, VK_SCROLL + 1)
= SetKeyboardState(@lccodes)

* For Windows NT, however, you have to use the keybd_event function, as follows:

* Simulate key down
= keybd_event(VK_SCROLL, 0x45, KEYEVENTF_EXTENDEDKEY, 0)
* Simulate key up
= keybd_event(VK_SCROLL, 0x45, BITOR(KEYEVENTF_EXTENDEDKEY, KEYEVENTF_KEYUP), 0)
I haven't provided further details since you seem to have access to the SDK. Let me know if you need further details.
George

Ubi caritas et amor, deus ibi est
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform