Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations bkrike on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Changing Language in Windows VIA VFP

Status
Not open for further replies.

Reming

Programmer
Jul 4, 2005
1
HU
I have a form that user can type in few languages , in order to change language from English to German for example he have to change it in the language bar in the XP (right down hand side) , can I make this change programticly in the form ???????
 
Try code below
Code:
  #DEFINE KEYBOARD_GERMAN_ST 	0x0407		&& Deutch (Standard)  
  #DEFINE KEYBOARD_ENGLISH_US 	0x0409		&& English (United States)  
  #DEFINE KEYBOARD_FRENCH_ST 	0x040c		&& French (Standard)  
  #DEFINE KEYBOARD_RUSSIAN 		0x0419		&& Russian  
    
 * Select layout that we need  
  LOCAL lnNeedKeyboard  
  lnNeedKeyboard = KEYBOARD_RUSSIAN  
    
 * Read current layout  
  DECLARE INTEGER GetKeyboardLayout IN Win32API Integer  
  LOCAL lnCurrentKeyboard  
  lnCurrentKeyboard = GetKeyboardLayout(0)  
 * Read 16 bits (lowest 16 bit from 32)  
  lnCurrentKeyboard = BitRShift(m.lnCurrentKeyboard,16)  
    
 * If current layout don't equal required  
  IF m.lnCurrentKeyboard <> m.lnNeedKeyboard  
 	* First of all try to activate layout that we need  
  	DECLARE INTEGER ActivateKeyboardLayout IN Win32API Integer, Integer  
  	LOCAL lnNewKeyboard  
  	lnNewKeyboard = ActivateKeyboardLayout(m.lnNeedKeyboard,0)  
    
  	IF m.lnNewKeyboard=0  
 		* We haven't required layout in alternative layouts list 
 		* so append layout we need  
  		DECLARE INTEGER LoadKeyboardLayout IN Win32API String, Integer  
 		* Transform code to string e.g. "00000419"  
 		* String contains  8 symbols where first 4 - zeroes, and rest 4  - code in Hex  
  		LOCAL lcNeedKeyboard  
  		lcNeedKeyboard = RIGHT(TRANSFROM(m.lnNeedKeyboard,"@0"),8)  
 		* loading...  
  		m.lnNewKeyboard = LoadKeyboardLayout(m.lcNeedKeyboard,1)  
 		* Read lowest bits  
  		m.lnNewKeyboard = BitRShift(m.lnNewKeyboard,16)  
  		IF m.lnNewKeyboard <> m.lnNeedKeyboard  
 			* We can't load required layout  
  		ENDIF  
  	ENDIF  
  ENDIF
[code]

Juri Shutenko
Municipality of Maardu, Estonia
[URL unfurl="true"]http://kodu.neti.ee/~juri4[/URL]
[URL unfurl="true"]http://www.hot.ee/jurisfox[/URL]
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top