Showing posts with label Keyboard. Show all posts
Showing posts with label Keyboard. Show all posts

Monday, December 10, 2012

VB6 Code - Merubah Keyboard Dari Inggris Ke Arab

Bagaimanakah cara memindahkan layout keyboard (misalnya dari english ke arabic atau sebaliknya) melalui pengkodean Visual Basic 6.0? Berikut solusinya:
'------------------------------------------------------------------------------- 
'http://khoiriyyah.blogspot.com
'Asep Hibban
'-------------------------------------------------------------------------------
Private Declare Function LoadKeyboardLayout Lib "user32" Alias "LoadKeyboardLayoutA" ByVal pwszKLID As String, ByVal flags As Long) As Long
Private Const
KLF_ACTIVATE = &H1

Private Sub
Command1_Click()
LoadKeyboardLayout "00000401", KLF_ACTIVATE 'pindah ke arab
Text1.Alignment = vbRightJustify
Text1.SetFocus
End Sub

Private Sub
Command2_Click()
LoadKeyboardLayout "00000409", KLF_ACTIVATE 'pindah ke inggris
Text1.Alignment = vbLeftJustify
Text1.SetFocus
End Sub

Private Sub
Text2_GotFocus()
LoadKeyboardLayout "00000409", KLF_ACTIVATE 'pindah ke inggris
Text2.Alignment = vbLeftJustify
End Sub

Private Sub
Text3_GotFocus()
LoadKeyboardLayout "00000401", KLF_ACTIVATE 'pindah ke arab
Text3.Alignment = vbRightJustify
End Sub
Kode di atas tentunya sangat berguna sekali pada membuat aplikasi-aplikasi arabic dengan Visual Basic 6.0, dengan demikian kalimat:

Ingat! sebelum Anda mengetik, pindahkah terlebih dahulu pada posisi arabic

sudah tidak diperlukan lagi.

Download: How To Change Keyboard Layout To Arabic
READ MORE - VB6 Code - Merubah Keyboard Dari Inggris Ke Arab

Friday, June 8, 2012

Menonaktifkan Keyboard dan Mouse - BlockInput

Option Explicit 

Private Declare Function
BlockInput Lib "user32" (ByVal fBlock As Long) As Long

Private Sub
Command1_Click()
Timer1.Enabled = True
BlockInput True
End Sub

'Gunakan kode di bawah, agar komputer Anda tidak usah di restart
Private Sub Form_Load()
Timer1.Interval = 1000 '1 detik
Timer1.Enabled = False
End Sub

'Timer1.Interval = 1000 '1 detik
Private Sub Timer1_Timer()
Static i As Integer
i = i +
1
If i > 5 Then 'tunggu 5 detik
BlockInput False 'aktifkan kembali keyboard dan mouse
i = 0
End If
End Sub
READ MORE - Menonaktifkan Keyboard dan Mouse - BlockInput

Monday, May 28, 2012

Mengetahui Keyboard Yang Sedang Digunakan

Di bawah ini merupakan procedure untuk mengetahui keyboard yang sedang digunakan.
Option Explicit 

Private Declare Function
GetKeyboardLayout Lib "user32" (ByVal dwLayout As Long) As Long
Private Declare Function
GetWindowThreadProcessId Lib "user32" (ByVal hwnd As Long, lpdwProcessId As Long) As Long

Public Sub
KeyBoardLanguage()

Dim
TheardId As Long
Dim
TheardLang As Long
Dim
processid As Long

TheardId = GetWindowThreadProcessId(hwnd, processid)
TheardLang = GetKeyboardLayout(ByVal TheardId)
TheardLang = TheardLang Mod 10000

Select Case
TheardLang
Case "9721"
MsgBox "English"
Case "5425"
MsgBox "Arabic"
Case Else
MsgBox "I don't know atuh, cari weh ku anjeun sorangan", vbInformation, "Don't Know"
End Select

End Sub
Contoh penggunaan procedure di atas:
Private Sub Command1_Click()   
KeyBoardLanguage
End Sub
READ MORE - Mengetahui Keyboard Yang Sedang Digunakan

Friday, December 30, 2011

Get GetKeyboardLayout language from a thread

Option Explicit  
'Get GetKeyboardLayout language from a thread
'Original code by Gringo Man
Private Declare Function GetKeyboardLayout Lib "user32" (ByVal dwLayout As Long) As Long
Private Declare Function
GetWindowThreadProcessId Lib "user32" (ByVal hwnd As Long, lpdwProcessId As Long) As Long

Public Sub
KeyBoardLanguage()

Dim
TheardId As Long
Dim
TheardLang As Long
Dim
processid As Long

TheardId = GetWindowThreadProcessId(hwnd, processid)
TheardLang = GetKeyboardLayout(ByVal TheardId)
TheardLang = TheardLang Mod 10000

If
TheardLang = "9721" Then
MsgBox "English"
ElseIf
TheardLang = "5425" Then
MsgBox "Arabic"
End If

End Sub

Private Sub
Command1_Click()
KeyBoardLanguage
End Sub
READ MORE - Get GetKeyboardLayout language from a thread

Sunday, April 4, 2010

VB6 Code - Memeriksa Bahasa dari Keyboard Digunakan

Di bawah ini merupakan procedure VB6 untuk mengetahui bahasa dari keyboard yang sedang digunakan.
Option Explicit

Private Declare Function GetKeyboardLayout Lib "user32" (ByVal dwLayout As Long) As Long
Private Declare Function GetWindowThreadProcessId Lib "user32" (ByVal hwnd As Long, lpdwProcessId As Long) As Long

Public Sub KeyBoardLanguage()

Dim TheardId As Long
Dim TheardLang As Long
Dim processid As Long

TheardId = GetWindowThreadProcessId(hwnd, processid)
TheardLang = GetKeyboardLayout(ByVal TheardId)
TheardLang = TheardLang Mod 10000

Select Case TheardLang
Case "9721"
MsgBox "English"
Case "5425"
MsgBox "Arabic"
Case Else
MsgBox "I don't know atuh, cari weh ku anjeun sorangan", vbInformation, "Don't Know"
End Select

End Sub
Contoh penggunaan procedure VB6 di atas:
Private Sub  Command1_Click()
KeyBoardLanguage
End Sub
Demikian kode VB6 untuk memmeriksa bahasa dari keyboard yang sedang digunakan. Semoga bermanfaat.
READ MORE - VB6 Code - Memeriksa Bahasa dari Keyboard Digunakan