Around multi languages keyboards

Published on by Yousfi Benameur

 
these 6 codes below turn around keyboards as  :

 1-windows OSk and positionning with APIs for showWindow=0,1
 2-get representation as image of 157 windows implemented keyboard
 3-virtual windows keyboards and defined keys
 4-a cool multilanguage web keyboard
 5- FreeVK OSK
 6-FreeVK and positionning with APIs for form.showWindow=0,1
 
 Codes are tested on windows 10 pro é vfp9SP2 & ie11 emulation


Click on code to select [then copy] -click outside to deselect


*1*
*this code execute the windows onscreen keyboard but as standalone (not embed on a form parent).
*the onscreen keyboard is fired and its window is positionned at the bottom of the form.
*a contextuel menu is fired with rightclcik event
*when the form is destroyed the osk is also closed.
*Warning: the osk caption is locallized 'depends on language used by os)
*in french it's : Clavier visuel"", in english:"On-Screen Keyboard"...to replace in code.this is used with API FindWindow.
*give the focus to the editbos (click on) and type on osk.
*i used WMI to close the osk.its very usefull.Taskill produce a bad black effect (when run with "!taskKill oske.exe".
*OSK.EXE is located on WINDOWS\SYSTEM32 folder.

Publi yform
yform=Newobject("yosk")
yform.Show
Read Events
Retu
*
Define Class yosk As Form
    BorderStyle = 0
	Top = 9
	Left = 10
	Height = 262
	Width = 836
	ShowWindow = 2
	Caption = "On Screen Keyboard"
	MaxButton = .F.
	Movable = .F.
	yhwnd = 0
	Name = "Form1"

	Add Object edit1 As EditBox With ;
		FontSize = 12, ;
		Height = 229, ;
		Left = 0, ;
		Top = 36, ;
		Width = 841, ;
		Name = "Edit1"

	Add Object command1 As CommandButton With ;
		Top = 3, ;
		Left = 216, ;
		Height = 25, ;
		Width = 73, ;
		Caption = "Run OSK", ;
		SpecialEffect = 2, ;
		BackColor = Rgb(128,255,0), ;
		Name = "Command1"

	Add Object check1 As Checkbox With ;
		Top = 12, ;
		Left = 540, ;
		Height = 17, ;
		Width = 97, ;
		AutoSize = .T., ;
		Alignment = 0, ;
		BackStyle = 0, ;
		Caption = "Form movable", ;
		Value = .F., ;
		Name = "Check1"
        
     procedure edit1.rightclick
DEFINE POPUP raccourci SHORTCUT RELATIVE FROM MROW(),MCOL()
DEFINE BAR _med_slcta OF raccourci PROMPT "Sélectionner tout" ;
    KEY CTRL+A, "Ctrl+A" ;
	PICTRES _med_slcta ;
	MESSAGE "Sélectionne tout le texte ou tous les éléments de la fenêtre active"
DEFINE BAR _med_paste OF raccourci PROMPT "Coller" ;
	KEY CTRL+V, "Ctrl+V" ;
	PICTRES _med_paste ;
	MESSAGE "Place le contenu du Presse-papiers au point d'insertion"
DEFINE BAR _med_copy OF raccourci PROMPT "Copier" ;
	KEY CTRL+C, "Ctrl+C" ;
	PICTRES _med_copy ;
	MESSAGE "Copie la sélection et la place dans le Presse-papiers"
DEFINE BAR _med_cut OF raccourci PROMPT "Couper" ;
	KEY CTRL+X, "Ctrl+X" ;
	PICTRES _med_cut ;
	MESSAGE "Enlève la sélection et la place dans le Presse-papiers"
DEFINE BAR _med_redo OF raccourci PROMPT "Rétablir" ;
	KEY CTRL+R, "Ctrl+R" ;
	PICTRES _med_redo
DEFINE BAR _med_undo OF raccourci PROMPT "Annuler" ;
	KEY CTRL+Z, "Ctrl+Z" ;
	PICTRES _med_undo ;
	MESSAGE "Annule la dernière modification"

ACTIVATE POPUP raccourci
       endproc    

	Procedure ypos
		If Thisform.yhwnd = 0
			! /N osk.Exe
			sleep(1000)   &&to adjust
			Thisform.yhwnd = FindWindow( .Null. , "Clavier visuel")    &&french locallized :english "On-Screen Keyboard")

			* position the window +resize it
			x=Thisform.Left
			Y=Thisform.Top+Thisform.Height+Sysmetric(9)+Sysmetric(4)
			cx=Thisform.Width+12
			cy=200

			SetWindowPos(Thisform.yhwnd , 1 , x, Y , cx , cy , 64 )
		Else
			* Close keyboard if already open
			Try
				Thisform.ykill()
				*	! TaskKill /F /IM osk.exe    &&a black window appears ?
			Catch
			Endtry
		Endif
		Thisform.edit1.SetFocus()  &&dont work properly -do it manually.
	Endproc

	Procedure ykill
		Local loWMI, lcQuery, loResult, loProcess
		loWMI = Getobject("winmgmts://")
		lcQuery = "select * from win32_process where name='osk.exe'"   &&here the exe name application to kill
		loResult = loWMI.ExecQuery(m.lcQuery)

		For Each loProcess In loResult
			loProcess.Terminate(0)
		Next
	Endproc

	Procedure Load
		Declare Long FindWindow In WIN32API String, String

		Declare Integer SetWindowPos In user32;
			INTEGER HWnd,;
			INTEGER hWndInsertAfter,;
			INTEGER x,;
			INTEGER Y,;
			INTEGER cx,;
			INTEGER cy,;
			INTEGER wFlags
		Declare Integer Sleep In kernel32 Integer

	Endproc



	Procedure Destroy
		Try
			*	! TaskKill /F /IM osk.exe
			Thisform.ykill()
		Catch
		Endtry
		Clea Events
	Endproc

	Procedure Init
		_Screen.WindowState=1
	Endproc

	Procedure command1.Click
		This.Caption=Iif(This.Caption="Run OSK","Hide OSK","Run OSK")
        if this.caption="Hide OSK"
        thisform.check1.value=.f.
        thisform.movable=.f.
        endi
		Thisform.yhwnd = FindWindow( .Null. , "Clavier visuel")        &&"On-Screen Keyboard" )
		Thisform.ypos()
	Endproc

	Procedure check1.Click
		Thisform.Movable=Iif(This.Value=.T.,.T.,.F.)
		If Thisform.Movable=.T.  &&for repositionning osk only
			*! TaskKill /F /IM osk.exe    &&a black window appears ?
			Thisform.ykill()
			Thisform.command1.Caption="Run OSK"
		Endi
	Endproc

Enddefine
*
*-- EndDefine: yosk



Around multi languages keyboards

Click on code to select [then copy] -click outside to deselect

 
 *2*
 *this code retrieves 157 windows keyboards annoted images from microsoft site.image are interactive and with unicode code of each key.
  
publi yform
yform=newObject("ykeyboards")
yform.show
read events
retu
*
DEFINE CLASS ykeyboards AS form
    BorderStyle = 0
	Height = 348
	Width = 425
	ShowWindow = 2
	AutoCenter = .T.
	Caption = "Form1"
	MaxButton = .F.
	BackColor = RGB(0,0,0)
	Name = "Form1"

	ADD OBJECT combo1 AS combobox WITH ;
		Height = 24, ;
		Left = 55, ;
		Top = 4, ;
		Width = 289, ;
		Name = "Combo1"

	ADD OBJECT olecontrol1 AS olecontrol WITH ;
	    oleclass="shell.explorer.2", ;
		Top = 29, ;
		Left = 0, ;
		Height = 172, ;
		Width = 431, ;
		Anchor = 15, ;
		Name = "Olecontrol1"

	ADD OBJECT edit1 AS editbox WITH ;
		FontBold = .T., ;
		BorderStyle = 0, ;
		Height = 141, ;
		Left = 2, ;
		ScrollBars = 0, ;
		Top = 206, ;
		Width = 421, ;
		ForeColor = RGB(128,0,64), ;
		BackColor = RGB(255,255,185), ;
		Name = "Edit1"

	PROCEDURE Init
		*adapted from *https://msdn.microsoft.com/en-us/goglobal/bb964651
		thisform.caption=trans(thisform.combo1.Listcount)+" Windows Keyboard Layouts."
	ENDPROC

	PROCEDURE combo1.Click
		local m.url
		m.url="https://www.microsoft.com/resources/msdn/goglobal/keyboards/"+allt(strextract(this.value,"--",""))  +".html"
		*messagebox(m.url)
		thisform.olecontrol1.navigate(m.url)
	ENDPROC

	PROCEDURE combo1.Init
		with this
		.additem(" -- ")
		.additem("Albanian -- kbdal")
		.additem("Arabic (101) -- kbda1")
		.additem("Arabic (102) -- kbda2")
		.additem("Arabic (102) AZERTY -- kbda3")
		.additem("Armenian Eastern -- kbdarme")
		.additem("Armenian Western -- kbdarmw")
		.additem("Assamese - INSCRIPT -- kbdinasa")
		.additem("Azeri Cyrillic -- kbdaze")
		.additem("Azeri Latin -- kbdazel")
		.additem("Bashkir† -- kbdbash")
		.additem("Bashkir -- kbdbhc")
		.additem("Belarusian -- kbdblr")
		.additem("Belgian (Comma) -- kbdbene")
		.additem("Belgian French -- kbdbe")
		.additem("Bengali -- kbdinben")
		.additem("Bengali-INSCRIPT -- kbdinbe1")
		.additem("Bengali-INSCRIPT Legacy  -- kbdinbe1")
		.additem(" Bulgarian Phonetic Traditional  *kbdbgph1 *")
		.additem(" Bulgarian Phonetic  -- kbdbgph ")
		.additem(" Bulgarian Typewriter -- kbdbu ")
		.additem("Canadian French -- kbdca")
		.additem("Canadian French (Legacy) -- kbdfc")
		.additem("Canadian Multilingual Standard -- kbdcan")
		.additem("Chinese Bopomofo IME -- kbdTCBO")
		.additem("Chinese ChaJei IME -- kbdTCCJ")
		.additem("Croatian -- kbdcr")
		.additem("Czech -- kbdcz")
		.additem("Czech (QWERTY) -- kbdcz1")
		.additem("Czech Programmers -- kbdcz2")
		.additem("Danish -- kbdda")
		.additem("Devanagari - INSCRIPT -- kbdindev")
		.additem("Divehi Phonetic -- kbddiv1")
		.additem("Divehi Typewriter -- kbddiv2")
		.additem("Dutch -- kbdne")
		.additem("Estonian -- kbdest")
		.additem("Faeroese -- kbdfo")
		.additem("Finnish -- kbdfi")
		.additem("Finnish with Sami -- kbdfi1")
		.additem("French -- kbdfr")
		.additem("Gaelic -- kbdgae")
		.additem("Georgian -- kbdgeo")
		.additem("Georgian (Ergonomic) -- kbdgeoer")
		.additem("Georgian (QWERTY) -- kbdgeoqw")
		.additem("German -- kbdgr")
		.additem("German (IBM) -- kbdgr1")
		.additem("Greek -- kbdhe")
		.additem("Greek (220) -- kbdhe220")
		.additem("Greek (220) Latin -- kbdhela2")
		.additem("Greek (319) -- kbdhe319")
		.additem("Greek (319) Latin -- kbdhela3")
		.additem("Greek Latin -- kbdgkl")
		.additem("Greek Polytonic -- kbdhept")
		.additem("Greenlandic -- kbdgrlnd")
		.additem("Gujarati* -- kbdinguj")
		.additem("Hausa‡ -- kbdhau")
		.additem("Hebrew -- kbdheb")
		.additem("Hindi Traditional -- kbdinhin")
		.additem("Hungarian -- kbdhu")
		.additem("Hungarian 101-key -- kbdhu1")
		.additem("Icelandic -- kbdic")
		.additem("Igbo‡ -- kbdibo")
		.additem("Inuktitut - Latin -- kbdiulat")
		.additem("Inuktitut - Naqittuat -- kbdinuk2")
		.additem("Irish -- kbdir")
		.additem("Italian -- kbdit")
		.additem("Italian (142) -- kbdit142")
		.additem("Japanese -- kbdJapan")
		.additem("Kannada* -- kbdinkan")
		.additem("Kazakh -- kbdkaz")
		.additem("Korean -- kbdKorea")
		.additem("Kyrgyz (Cyrillic) -- kbdKyr")
		.additem("Lao -- kbdlao")
		.additem("Latin American -- kbdla")
		.additem("Latvian -- kbdlv")
		.additem("Latvian (QWERTY) -- kbdlv1")
		.additem("Lithuanian -- kbdlt1")
		.additem("Lithuanian IBM -- kbdlt")
		.additem("Lithuanian Standard -- kbdlt2")
		.additem("Luxembourgish -- kbdsf")
		.additem("Macedonian (FYROM) -- kbdmac")
		.additem("Macedonian (FYROM) - Standard -- kbdmacst")
		.additem("Malayalam -- kbdinmal")
		.additem("Maori -- kbdmaori")
		.additem("Maltese 47 -- kbdmlt47")
		.additem("Maltese 48 -- kbdmlt48")
		.additem("Maori -- kbdmaori")
		.additem("Marathi -- kbdinmar")
		.additem("Mongolian (Cyrillic) -- kbdmon")
		.additem("Mongolian (Mongolian Script) -- kbdmonmo")
		.additem("Nepali -- kbdnepr")
		.additem("Norwegian -- kbdno")
		.additem("Norwegian with Sami -- kbdno1")
		.additem("Oriya -- kbdinori")
		.additem("Pashto (Afghanistan) -- kbdpash")
		.additem("Persian -- kbdfa")
		.additem("Polish (214) -- kbdpl")
		.additem("Polish (Programmers) -- kbdpl1")
		.additem("Portuguese -- kbdpo")
		.additem("Portuguese (Brazilian ABNT) -- kbdbr")
		.additem("Punjabi (Gurmukhi) -- kbdinpun")
		.additem("Romanian (Legacy) -- kbdro")
		.additem("Romanian (Programmers) -- kbdropr")
		.additem("Romanian (Standard) -- kbdrost")
		.additem("Russian -- kbdru")
		.additem("Russian (Typewriter) -- kbdru1")
		.additem("Sami Extended Finland-Sweden -- kbdsmsfi")
		.additem("Sami Extended Norway -- kbdsmsno")
		.additem("Serbian (Cyrillic) -- kbdycc")
		.additem("Serbian (Latin) -- kbdycl")
		.additem("Sesotho sa Leboa‡ -- kbdnso1")
		.additem("Setawana‡ -- kbdnso")
		.additem("Sinhala -- kbdsn1")
		.additem("Sinhala -Wij 9 -- kbdsw09")
		.additem("Slovak -- kbdsl")
		.additem("Slovak (QWERTY) -- kbdsl1")
		.additem("Slovenian -- kbdcr")
		.additem("Sorbian Extended -- kbdsorex")
		.additem("Sorbian Standard‡ -- kbdsors1")
		.additem("Sorbian Standard (Legacy) -- kbdsorst")
		.additem("Spanish -- kbdsp")
		.additem("Spanish Variation -- kbdes")
		.additem("Swedish -- kbdsw")
		.additem("Swedish with Sami -- kbdsw1")
		.additem("Swiss French -- kbdsf")
		.additem("Swiss German -- kbdsg")
		.additem("Syriac Standard -- kbdsyr1")
		.additem("Syriac Phonetic -- kbdsyr2")
		.additem("Tajik -- kbdtajik")
		.additem("Tamil -- kbdintam")
		.additem("Tatar -- kbdtat")
		.additem("Telugu* -- kbdintel")
		.additem("Thai Kedmanee -- kbdth0")
		.additem("Thai Kedmanee (non-ShiftLock) -- kbdth2")
		.additem("Thai Pattachote -- kbdth1")
		.additem("Thai Pattachote (non-ShiftLock) -- kbdth3")
		.additem("Tibetan (PRC)‡ -- kbdtiprc")
		.additem("Turkish F -- kbdtuf")
		.additem("Turkish Q -- kbdtuq")
		.additem("Turkmen -- kbdturme")
		.additem("Ukrainian -- kbdur")
		.additem("Ukrainian (Enhanced) -- kbdur1")
		.additem("United Kingdom -- kbduk")
		.additem("United Kingdom Extended -- kbdukx")
		.additem("Urdu -- kbdurdu")
		.additem("US English -- kbdus")
		.additem("US English (IBM Arabic 238_L) -- kbdusa")
		.additem("US-Dvorak -- kbddv")
		.additem("US-Dvorak for left hand -- kbdusl")
		.additem("US-Dvorak for right hand -- kbdusr")
		.additem("US-International -- kbdusx")
		.additem("Uyghur‡ -- kbdughr1")
		.additem("Uyghur (Legacy) -- kbdughr")
		.additem("Uzbek Cyrillic -- kbduzb")
		.additem("Vietnamese -- kbdvntc")
		.additem("Wolof‡ -- kbdwol")
		.additem("Yakut‡ -- kbdyak")
		.additem("Yoruba‡ -- kbdyba")
		.listindex=2
		.style=2
		endwith
	ENDPROC

	PROCEDURE olecontrol1.Init
		this.silent=.t.
	ENDPROC

	PROCEDURE edit1.Init
		text to this.value noshow
		To see different keyboard states, move the mouse over state keys such as Shift, Caps or AltGr.
		You can also lock or unlock those keys by clicking them.

		Layouts shipped in Windows XP and Windows Server 2003 are marked by an asterisk (*).
		Layouts shipped in Windows XP Service Pack 2 are marked by (**).
		Layouts shipped in Windows Vista and Windows Server 2008 are marked by (†).
		Layouts shipped in Windows 7 and Windows Server 2008 R2 are marked by (‡).
		endtext
	ENDPROC
	Procedure destroy
	clea events
	endproc


ENDDEFINE
*
*-- EndDefine: ykeyboards



rightclick on image to save it on disc.

rightclick on image to save it on disc.

Click on code to select [then copy] -click outside to deselect


*3*
*The following table shows the symbolic constant names, hexadecimal values, and mouse or keyboard equivalents for the virtual-key codes used by the system. it is presented as #define constants
*The codes are listed in numeric order. 
*#define preprocessor directives  creates compile-time constants in programs. By creating constants with #DEFINE instead of using variables, you can reduce memory consumption, increase performance, and simplify programs.
*this can be mostly used in keybd_event API as shown in previous posts.

 *from https://msdn.microsoft.com/en-us/library/windows/desktop/dd375731%28v=vs.85%29.aspx

#define VK_LBUTTON 0x01 &&Left mouse button
#define VK_RBUTTON 0x02 &&Right mouse button
#define VK_CANCEL 0x03 &&Control-break processing
#define VK_MBUTTON 0x04 Middle &&mouse button (three-button mouse)
#define VK_XBUTTON1 0x05 X1 &&mouse button
#define VK_XBUTTON2 0x06 X2 &&mouse button
*- 0x07 Undefined
#define VK_BACK 0x08 &&BACKSPACE key
#define VK_TAB 0x09 &&TAB key
#define 0x0A-0B &&Reserved
#define VK_CLEAR 0x0C &&CLEAR key
#define VK_RETURN 0x0D &&ENTER key
* 0x0E-0F &&Undefined
#define VK_SHIFT 0x10 &&SHIFT key
#define VK_CONTROL 0x11 &&CTRL key
#define VK_MENU 0x12 &&ALT key
#define VK_PAUSE 0x13 &&PAUSE key
#define VK_CAPITAL 0x14 &&CAPS LOCK key
#define VK_KANA 0x15 &&IME Kana mode
#define VK_HANGUEL 0x15 &&IME Hanguel mode (maintained for compatibility; use  VK_HANGUL)
#define VK_HANGUL 0x15 &&IME Hangul mode
* 0x16 &&Undefined
#define VK_JUNJA 0x17 &&IME Junja mode
#define VK_FINAL 0x18 &&IME final mode
#define VK_HANJA 0x19 &&IME Hanja mode
#define VK_KANJI 0x19 &&IME Kanji mode
*- 0x1A &&Undefined
#define VK_ESCAPE 0x1B &&ESC key
#define VK_CONVERT 0x1C &&IME convert
#define VK_NONCONVERT 0x1D &&IME nonconvert
#define VK_ACCEPT 0x1E &&IME accept
#define VK_MODECHANGE 0x1F &&IME mode change request
#define VK_SPACE 0x20 &&SPACEBAR
#define VK_PRIOR 0x21 &&PAGE UP key
#define VK_NEXT 0x22 PAGE &&DOWN key
#define VK_END 0x23 &&END key
#define VK_HOME 0x24 &&HOME key
#define VK_LEFT 0x25 &&LEFT ARROW key
#define VK_UP 0x26 &&UP ARROW key
#define VK_RIGHT 0x27 &&RIGHT ARROW key
#define VK_DOWN 0x28 &&DOWN ARROW key
#define VK_SELECT 0x29 &&SELECT key
#define VK_PRINT 0x2A &&PRINT key
#define VK_EXECUTE 0x2B &&EXECUTE key
#define VK_SNAPSHOT 0x2C &&PRINT SCREEN key
#define VK_INSERT 0x2D &&INS key
#define VK_DELETE 0x2E &&DEL key
#define VK_HELP 0x2F &&HELP key
#define 0x30 &&0 key
#define 0X31 &&1 key
#define 0X32 &&2 key
#define 0X33 &&3 key
#define 0X34 &&4 key
#define 0X35 &&5 key
#define 0X36 &&6 key
#define 0X37 &&7 key
#define 0X38 &&8 key
#define 0X39 &&9 key
*- 0x3A-40 &&Undefined
#define 0X41 &&A key
#define 0X42 &&B key
#define 0X43 &&C key
#define 0X44 &&D key
#define 0X45 &&E key
#define 0X46 &&F key
#define 0X47 &&G key
#define 0X48 &&H key
#define 0X49 &&I key
#define 0X4A &&J key
#define 0X4B &&K key
#define 0X4C &&L key
#define 0X4D &&M key
#define 0X4E &&N key
#define 0X4F &&O key
#define 0X50 &&P key
#define 0X51 &&Q key
#define 0X52 &&R key
#define 0X53 &&S key
#define 0X54 &&T key
#define 0X55 &&U key
#define 0X56 &&V key
#define 0X57 &&W key
#define 0X58 &&X key
#define 0X59 &&Y key
#define 0X5A &&Z key
#define VK_LWIN 0x5B&& Left Windows key (Natural keyboard)
#define VK_RWIN 0x5C &&Right Windows key (Natural keyboard)
#define VK_APPS 0x5D &&Applications key (Natural keyboard)
*- 0x5E &&Reserved
#define VK_SLEEP 0x5F &&Computer Sleep key
#define VK_NUMPAD0 &&0x60&& Numeric keypad 0 key
#define VK_NUMPAD1 &&0x61 Numeric keypad 1 key
#define VK_NUMPAD2 &&0x62 Numeric keypad 2 key
#define VK_NUMPAD3 &&0x63 Numeric keypad 3 key
#define VK_NUMPAD4 &&0x64 Numeric keypad 4 key
#define VK_NUMPAD5 &&0x65 Numeric keypad 5 key
#define VK_NUMPAD6 &&0x66 Numeric keypad 6 key
#define VK_NUMPAD7 &&0x67 Numeric keypad 7 key
#define VK_NUMPAD8 &&0x68 Numeric keypad 8 key
#define VK_NUMPAD9 &&0x69 Numeric keypad 9 key
#define VK_MULTIPLY 0x6A &&Multiply key
#define VK_ADD 0x6B &&Add key
#define VK_SEPARATOR 0x6C &&Separator key
#define VK_SUBTRACT 0x6D &&Subtract key
#define VK_DECIMAL 0x6E &&Decimal key
#define VK_DIVIDE 0x6F &&Divide key
#define VK_F1 0x70 &&F1 key
#define VK_F2 0x71&& F2 key
#define VK_F3 0x72 &&F3 key
#define VK_F4 0x73&& F4 key
#define VK_F5 0x74 &&F5 key
#define VK_F6 0x75 &&F6 key
#define VK_F7 0x76 &&F7 key
#define VK_F8 0x77 &&F8 key
#define VK_F9 0x78 &&F9 key
#define VK_F10 0x79 &&F10 key
#define VK_F11 0x7A &&F11 key
#define VK_F12 0x7B &&F12 key
#define VK_F13 0x7C &&F13 key
#define VK_F14 0x7D &&F14 key
#define VK_F15 0x7E &&F15 key
#define VK_F16 0x7F &&F16 key
#define VK_F17 0x80 &&F17 key
#define VK_F18 0x81 &&F18 key
#define VK_F19 0x82 &&F19 key
#define VK_F20 0x83 &&F20 key
#define VK_F21 0x84 &&F21 key
#define VK_F22 0x85 &&F22 key
#define VK_F23 0x86 &&F23 key
#define VK_F24 0x87&& F24 key
*- 0x88-8F &&Unassigned
#define VK_NUMLOCK 0x90 &&NUM LOCK key
#define VK_SCROLL 0x91 &&SCROLL LOCK key
*0x92-96 &&OEM specific
*- 0x97-9F &&Unassigned
#define VK_LSHIFT 0xA0 &&Left SHIFT key
#define VK_RSHIFT 0xA1 &&Right SHIFT key
#define VK_LCONTROL 0xA2 &&Left CONTROL key
#define VK_RCONTROL 0xA3 &&Right CONTROL key
#define VK_LMENU 0xA4 &&Left MENU key
#define VK_RMENU 0xA5 &&Right MENU key
#define VK_BROWSER_BACK 0xA6 &&Browser Back key
#define VK_BROWSER_FORWARD 0xA7 &&Browser Forward key
#define VK_BROWSER_REFRESH 0xA8&& Browser Refresh key
#define VK_BROWSER_STOP 0xA9 &&Browser Stop key
#define VK_BROWSER_SEARCH 0xAA &&Browser Search key
#define VK_BROWSER_FAVORITES 0xAB &&Browser Favorites key
#define VK_BROWSER_HOME 0xAC &&Browser Start and Home key
#define VK_VOLUME_MUTE 0xAD &&Volume Mute key
#define VK_VOLUME_DOWN 0xAE &&Volume Down key
#define VK_VOLUME_UP 0xAF &&Volume Up key
#define VK_MEDIA_NEXT_TRACK 0xB0 &&Next Track key
#define VK_MEDIA_PREV_TRACK 0xB1 &&Previous Track key
#define VK_MEDIA_STOP 0xB2 &&Stop Media key
#define VK_MEDIA_PLAY_PAUSE 0xB3 &&Play/Pause Media key
#define VK_LAUNCH_MAIL 0xB4 &&Start Mail key
#define VK_LAUNCH_MEDIA_SELECT 0xB5 &&Select Media key
#define VK_LAUNCH_APP1 0xB6 Start &&Application 1 key
#define VK_LAUNCH_APP2 0xB7 Start &&Application 2 key
*- 0xB8-B9 &&Reserved
#define VK_OEM_1 0xBA  && Used for miscellaneous characters; it can vary by keyboard. For the US standard keyboard, the ';:' key

#define VK_OEM_PLUS 0xBB &&For any country/region, the '+' key
#define VK_OEM_COMMA 0xBC &&For any country/region, the ',' key
#define VK_OEM_MINUS 0xBD &&For any country/region, the '-' key
#define VK_OEM_PERIOD 0xBE &&For any country/region, the '.' key
#define VK_OEM_2 0xBF &&Used for miscellaneous characters; it can vary by keyboard. For the US standard keyboard, the '/?' key

#define VK_OEM_3 0xC0 &&Used for miscellaneous characters; it can vary by keyboard. For the US standard keyboard, the '`~' key
*- 0xC1-D7 &&Reserved
*- 0xD8-DA &&Unassigned
#define VK_OEM_4 0xDB &&Used for miscellaneous characters; it can vary by keyboard. For the US standard keyboard, the '[{' key

#define VK_OEM_5 0xDC &&Used for miscellaneous characters; it can vary by keyboard. For the US standard keyboard, the '\|' key

#define VK_OEM_6 0xDD &&Used for miscellaneous characters; it can vary by keyboard. For the US standard keyboard, the ']}' key

#define VK_OEM_7 0xDE &&Used for miscellaneous characters; it can vary by keyboard. For the US standard keyboard, the 'single-quote/double-quote' key

#define VK_OEM_8 0xDF &&Used for miscellaneous characters; it can vary by keyboard.
*- 0xE0 &&Reserved
*0xE1 &&OEM specific
#define VK_OEM_102 0xE2 &&Either the angle bracket key or the backslash key on the RT 102-key keyboard
*0xE3-E4 OEM &&specific
#define VK_PROCESSKEY 0xE5 &&IME PROCESS key
*0xE6 &&OEM specific
#define VK_PACKET 0xE7 &&Used to pass Unicode characters as if they were keystrokes. The VK_PACKET key is the low word of a 32-bit Virtual Key value used for non-keyboard input methods. For more information, see Remark in KEYBDINPUT, SendInput, WM_KEYDOWN, and WM_KEYUP

*- 0xE8 &&Unassigned
*0xE9-F5 &&OEM specific
#define VK_ATTN 0xF6 &&Attn key
#define VK_CRSEL 0xF7 &&CrSel key
#define VK_EXSEL 0xF8 &&ExSel key
#define VK_EREOF 0xF9 &&Erase EOF key
#define VK_PLAY 0xFA &&Play key
#define VK_ZOOM 0xFB &&Zoom key
#define VK_NONAME 0xFC&& Reserved
#define VK_PA1 0xFD &&PA1 key
#define VK_OEM_CLEAR 0xFE&& Clear key


Click on code to select [then copy] -click outside to deselect


*4*
*this code shows a multi language windows keyboard with 157 possibilities without switching languages in OS (as OSK).its very usefull to embed as utility.its from http://mottie.github.io/Keyboard/index.html (can download).


Publi yform
yform=Newobject("yvk")
yform.Show
Read Events
Retu
*
Define Class yvk As Form
    BorderStyle = 0
	Height = 492
	Width = 881
	ShowWindow = 2
	AutoCenter = .T.
	Caption = "Form1"
	Name = "Form1"

	Add Object olecontrol1 As OleControl With ;
		oleclass="shell.explorer.2", ;
		Top = -108, ;
		Left = -12, ;
		Height = 600, ;
		Width = 972, ;
		Name = "olecontrol1"

	Add Object timer1 As Timer With ;
		Top = 24, ;
		Left = 60, ;
		Height = 23, ;
		Width = 23, ;
		Enabled = .F., ;
		Interval = 6000, ;
		Name = "Timer1"

	Procedure Init
		Thisform.timer1.Enabled=.T.
	Endproc

	Procedure Destroy
		Clea Events
	Endproc

	Procedure olecontrol1.Init
		This.silent=.T.
		This.Navigate("http://mottie.github.io/Keyboard/docs/layouts3.html")
	Endproc

	Procedure timer1.Timer
		Thisform.olecontrol1.Document.body.Scroll="no"
		Thisform.Caption=Thisform.olecontrol1.Document.Title +" -(157 windows keyboards)."
		This.Enabled=.F.
	Endproc

Enddefine
*
*-- EndDefine: yvk



can copy the textbox result with rightclick.

can copy the textbox result with rightclick.

Click on code to select [then copy] -click outside to deselect



*5*
*this OSK is free and can be downloaded at:http://freevirtualkeyboard.com/ (as exe:227 ko)
*its similar to  the windows OSK and it depends also of the language currently set on system (if you switch
* on the lang bar the keyboard installed this  switch also interactivelly to this new keyboard.
*this code execute the freeVK onscreen keyboard but as standalone (not embed on a form parent).
*the onscreen keyboard is fired and its window is positionned at the bottom of the form.
*a contextuel menu is fired with rightclcik event
*when the form is destroyed the osk is also closed.
*the osk caption is not locallized
*it's window caption is always: "Free Virtual Keyboard (www.FreeVirtualKeyboard.com)"
*give the focus to the editbos (click on) and type on osk.
*i used WMI to close the osk.its very usefull.Taskill produce a bad black effect (when run with "!taskKill oske.exe""
*note:this is more simple to embed on a form with APIS than the windows OSK
*this code is exactly as the *1* code above for windows OSK.


publi m.yrep
m.yrep=addbs(justpath(sys(16,1)))
set defa to (yrep)
if !file(m.yrep+"freeVK.exe")
messagebox("FreeVK.exe must be in this folder!",16+4096,"error",1200)
return .f.
endi

Publi yform
yform=Newobject("yfreeVK")
yform.Show
Read Events
Retu
*
Define Class yfreeVK As Form
    BorderStyle = 0
	Top = 9
	Left = 10
	Height = 262
	Width = 836
	ShowWindow = 2
	Caption = "VKfree On Screen Keyboard"
	MaxButton = .F.
	Movable = .F.
	yhwnd = 0
	Name = "Form1"

	Add Object edit1 As EditBox With ;
		FontSize = 12, ;
		Height = 229, ;
		Left = 0, ;
		Top = 36, ;
		Width = 841, ;
		Name = "Edit1"

	Add Object command1 As CommandButton With ;
		Top = 3, ;
		Left = 216, ;
		Height = 25, ;
		Width = 73, ;
		Caption = "Run freeVK", ;
		SpecialEffect = 2, ;
		BackColor = Rgb(128,255,0), ;
		Name = "Command1"

	Add Object check1 As Checkbox With ;
		Top = 12, ;
		Left = 540, ;
		Height = 17, ;
		Width = 97, ;
		AutoSize = .T., ;
		Alignment = 0, ;
		BackStyle = 0, ;
		Caption = "Form movable", ;
		Value = .F., ;
		Name = "Check1"
        
   Procedure edit1.RightClick
    	Define Popup raccourci SHORTCUT Relative From Mrow(),Mcol()
		Define Bar _Med_slcta Of raccourci Prompt "Sélectionner tout" ;
			KEY CTRL+A, "Ctrl+A" ;
			PICTRES _Med_slcta ;
			MESSAGE "Sélectionne tout le texte ou tous les éléments de la fenêtre active"
		Define Bar _Med_paste Of raccourci Prompt "Coller" ;
			KEY CTRL+V, "Ctrl+V" ;
			PICTRES _Med_paste ;
			MESSAGE "Place le contenu du Presse-papiers au point d'insertion"
		Define Bar _Med_copy Of raccourci Prompt "Copier" ;
			KEY CTRL+C, "Ctrl+C" ;
			PICTRES _Med_copy ;
			MESSAGE "Copie la sélection et la place dans le Presse-papiers"
		Define Bar _Med_cut Of raccourci Prompt "Couper" ;
			KEY CTRL+X, "Ctrl+X" ;
			PICTRES _Med_cut ;
			MESSAGE "Enlève la sélection et la place dans le Presse-papiers"
		Define Bar _Med_redo Of raccourci Prompt "Rétablir" ;
			KEY CTRL+R, "Ctrl+R" ;
			PICTRES _Med_redo
		Define Bar _Med_undo Of raccourci Prompt "Annuler" ;
			KEY CTRL+Z, "Ctrl+Z" ;
			PICTRES _Med_undo ;
			MESSAGE "Annule la dernière modification"

		Activate Popup raccourci
	Endproc

	Procedure ypos
		If Thisform.yhwnd = 0
			! /N freeVK.Exe
			sleep(500)
			Thisform.yhwnd = FindWindow( .Null. , "Free Virtual Keyboard (www.FreeVirtualKeyboard.com)")
			* position the window +resize it
			x=Thisform.Left
			Y=Thisform.Top+Thisform.Height+Sysmetric(9)+Sysmetric(4)
			cx=Thisform.Width+12
			cy=200

			SetWindowPos(Thisform.yhwnd , 1 , x, Y , cx , cy , 64 )
		Else
			* Close keyboard if already open
			Try
				Thisform.ykill()
				*	! TaskKill /F /IM osk.exe    &&a black window appears ?
			Catch
			Endtry
		Endif
		Thisform.edit1.SetFocus()
	Endproc

	Procedure ykill
		Local loWMI, lcQuery, loResult, loProcess
		loWMI = Getobject("winmgmts://")
		lcQuery = "select * from win32_process where name='freeVK.exe'"   &&here the exe name application to kill
		loResult = loWMI.ExecQuery(m.lcQuery)

		For Each loProcess In loResult
			loProcess.Terminate(0)
		Next
	Endproc

	Procedure Load
		Declare Long FindWindow In WIN32API String, String

		Declare Integer SetWindowPos In user32;
			INTEGER HWnd,;
			INTEGER hWndInsertAfter,;
			INTEGER x,;
			INTEGER Y,;
			INTEGER cx,;
			INTEGER cy,;
			INTEGER wFlags
		Declare Integer Sleep In kernel32 Integer
	Endproc

	Procedure Destroy
		Try
			*	! TaskKill /F /IM osk.exe
			Thisform.ykill()
		Catch
		Endtry
		Clea Events
	Endproc

	Procedure Init
		_Screen.WindowState=1
	Endproc

	Procedure command1.Click
		This.Caption=Iif(This.Caption="RunfreeVK","Hide freeVK","Run freeVK")
		If This.Caption="Hide OSK"
			Thisform.check1.Value=.F.
			Thisform.Movable=.F.
		Endi
		Thisform.yhwnd = FindWindow( .Null. , "Free Virtual Keyboard (www.FreeVirtualKeyboard.com)")        &&"On-Screen Keyboard" )
		Thisform.ypos()
	Endproc

	Procedure check1.Click
		Thisform.Movable=Iif(This.Value=.T.,.T.,.F.)
		If Thisform.Movable=.T.  &&for repositionning osk only
			*! TaskKill /F /IM osk.exe    &&a black window appears ?
			Thisform.ykill()
			Thisform.command1.Caption="Run freeVK"
		Endi
	Endproc

Enddefine
*
*-- EndDefine: freeVK





Around multi languages keyboards

Click on code to select [then copy] -click outside to deselect

 
*6*
*this code position the freevK as child on a form(showWindow=0,1 only).
*freeVk.exe must be on source folder mandatory to be executed.
*righclick on editbox to fire a contextuel menu.
*give the focus to editbox to begin typing (simply click on)

Publi yform
yform=Newobject("freeVK")
yform.Show
Read Events
*
Define Class freeVK As Form
    BorderStyle = 0
	AutoCenter=.T.
	Top = 0
	Left = 0
	Height = 390
	Width = 881
	Caption = "freevk onscreen keyboard"
	MaxButton = .F.
	yhwnd = 0
	Name = "Form1"

	Add Object edit1 As EditBox With ;
		FontBold = .T., ;
		FontSize = 11, ;
		Anchor = 768, ;
		Height = 193, ;
		Left = 0, ;
		Top = 0, ;
		Width = 877, ;
		Name = "Edit1"

	Procedure yposition
		* positioning vkfree on form
		#Define SWP_SHOWWINDOW      64
		Local m.x,m.y,m.cx,m.cy
		m.x=1
		m.y=Thisform.edit1.Top+Thisform.edit1.Height+1
		m.cx=Thisform.Width-2
		m.cy=Thisform.Height-m.y

		= SetWindowPos(Thisform.yhwnd, 1,m.x,m.y,m.cx,m.cy, SWP_SHOWWINDOW)

	Endproc

	Procedure ykill
		Local loWMI, lcQuery, loResult, loProcess
		loWMI = Getobject("winmgmts://")
		lcQuery = "select * from win32_process where name='freeVK.exe'"   &&here the exe name application to kill
		loResult = loWMI.ExecQuery(m.lcQuery)

		For Each loProcess In loResult
			loProcess.Terminate(0)
		Next
	Endproc


	Procedure Destroy
		Try
			*! TaskKill /F /IM freeVK.exe
			Thisform.ykill()
		Catch
		Endtry
		Clea Events
	Endproc


	Procedure Load
		Declare Integer Sleep In kernel32 Integer
		Declare Integer FindWindow In user32;
			STRING lpClassName, String lpWindowName

		Declare Integer SetParent In user32;
			INTEGER hWndChild, Integer hWndNewParent

		Declare Integer SetWindowPos In user32;
			INTEGER HWnd,;
			INTEGER hWndInsertAfter,;
			INTEGER x,;
			INTEGER Y,;
			INTEGER cx,;
			INTEGER cy,;
			INTEGER wFlags
		Declare Integer SetForegroundWindow In user32;
			INTEGER hWindow
		Declare Integer BringWindowToTop In user32 Integer

	Endproc

	Procedure Init
		Set Defa To Addbs(Justpath(Sys(16,1)))
		If !File("freeVK.exe")
			Messagebox("freeVK.exe must be in folder!",16+4096,"error",1200)
			Return .F.
		Endi

		#Define SW_SHOWNORMAL  1
		Local yhwnd
		i=0
		Do While .T.
			yhwnd = FindWindow(Null, "Free Virtual Keyboard (www.FreeVirtualKeyboard.com)" )
			If yhwnd = 0
				Run/N freeVK.Exe
			Else
				Exit
			Endif
			i=i+1
			If i>10
				Exit
			Endi
		Enddo

		* Change the parent window for the calculator.
		= SetParent(yhwnd, Thisform.HWnd)  &&Handle to the previous owner
		Thisform.yhwnd=m.yhwnd
		Thisform.yposition()
	Endproc

	Procedure Activate
		Thisform.edit1.click   &&SetFocus   &&dont work
	Endproc


	Procedure edit1.RightClick
		Define Popup raccourci SHORTCUT Relative From Mrow(),Mcol()
		Define Bar _Med_slcta Of raccourci Prompt "Sélectionner tout" ;
			KEY CTRL+A, "Ctrl+A" ;
			PICTRES _Med_slcta ;
			MESSAGE "Sélectionne tout le texte ou tous les éléments de la fenêtre active"
		Define Bar _Med_paste Of raccourci Prompt "Coller" ;
			KEY CTRL+V, "Ctrl+V" ;
			PICTRES _Med_paste ;
			MESSAGE "Place le contenu du Presse-papiers au point d'insertion"
		Define Bar _Med_copy Of raccourci Prompt "Copier" ;
			KEY CTRL+C, "Ctrl+C" ;
			PICTRES _Med_copy ;
			MESSAGE "Copie la sélection et la place dans le Presse-papiers"
		Define Bar _Med_cut Of raccourci Prompt "Couper" ;
			KEY CTRL+x, "Ctrl+X" ;
			PICTRES _Med_cut ;
			MESSAGE "Enlève la sélection et la place dans le Presse-papiers"
		Define Bar _Med_redo Of raccourci Prompt "Rétablir" ;
			KEY CTRL+R, "Ctrl+R" ;
			PICTRES _Med_redo
		Define Bar _Med_undo Of raccourci Prompt "Annuler" ;
			KEY CTRL+Z, "Ctrl+Z" ;
			PICTRES _Med_undo ;
			MESSAGE "Annule la dernière modification"

		Activate Popup raccourci
	Endproc


Enddefine
*
*-- EndDefine: freeVK



Around multi languages keyboards
To be informed of the latest articles, subscribe:
Comment on this post