Re: Keyboard Language

Tech-Archive recommends: Fix windows errors by optimizing your registry



vfpDev@xxxxxxxxxxx napsal(a):
How can I change the language of the keyboard from VFP?

thanks

FUNCTION ActivateKeyboard(pcLN)
* pcLN char code: LayoutName - see FoxPro.H (CZ: 05, ENG: 09 ...)
* returns .T. if O.K., .F. if requested LayoutName not installed
local xcLN, xcLangCode, xcOriginLC
pcLN=iif(empty(pcLN), [09], pcLN) && default ENG

DECLARE INTEGER GetKeyboardLayoutName IN WIN32API STRING @
DECLARE INTEGER ActivateKeyboardLayout IN WIN32API INTEGER, INTEGER

xcLN=SPACE(9)
GetKeyboardLayoutName(@xcLN)
xcLangCode=substr(xcLN, 7, 2)
xcOriginLC=xcLangCode

IF xcLangCode==pcLN && set, do nothing
RETURN .T.
ENDIF
ActivateKeyboardLayout(0, 1) && set another LN
GetKeyboardLayoutName(@xcLN)
xcLangCode=substr(xcLN, 7, 2)
DO WHILE xcLangCode <> xcOriginLC
IF xcLangCode==pcLN && requested LN, end
RETURN .T.
ENDIF
ActivateKeyboardLayout(0, 1) && set next LN
GetKeyboardLayoutName(@xcLN)
xcLangCode=substr(xcLN, 7, 2)
ENDDO
RETURN .F.
.



Relevant Pages

  • Re: Check for Running Programs
    ... > periodically check to see if the app is running and start it if it isn't. ... declare integer FindWindow in Win32API string, ... declare integer SetWindowPos in Win32API integer, integer, integer, integer, ... lnhnd = FindWindow ...
    (microsoft.public.fox.programmer.exchange)
  • Re: selprint
    ... DECLARE INTEGER CreateDC IN Win32Api STRING, STRING, INTEGER, INTEGER ... DECLARE INTEGER DeleteDC IN Win32Api INTEGER ... > Private Sub Command1_Click ...
    (microsoft.public.fox.vfp.forms)
  • Re: selprint
    ... > DECLARE INTEGER CreateDC IN Win32Api STRING, STRING, INTEGER, INTEGER ... > DECLARE INTEGER DeleteDC IN Win32Api INTEGER ... >> Private Sub Command1_Click ...
    (microsoft.public.fox.vfp.forms)
  • Re: App focus is lost on startup
    ... >> Does anyone know what might give rise to this behaviour or how I can ... > Declare Integer FindWindow In Win32API String, ... > Declare Integer SetForegroundWindow In user32 Integer hWindow ...
    (microsoft.public.fox.programmer.exchange)
  • Re: App focus is lost on startup
    ... > focus back to my app. ... Declare Integer FindWindow In Win32API String, ... Declare Integer SetForegroundWindow In user32 Integer hWindow ...
    (microsoft.public.fox.programmer.exchange)