728x90
[C#/ VB.NET] [API] 한/영 키 상태 값 구하기
Imports System.Runtime.InteropServices
Public Class Form1
Private Declare Function ImmGetContext Lib "imm32.dll" (ByVal hwnd As Integer) As Integer
Private Declare Function ImmGetConversionStatus Lib "imm32.dll" (ByVal himc As Integer, ByRef lpdw As Integer, ByRef lpdw2 As Integer) As Integer
Declare Function ImmReleaseContext Lib "imm32.dll" (ByVal hWnd As Integer, ByVal hIMC As Integer) As Integer
Protected Overrides Sub OnLoad(ByVal e As System.EventArgs)
MyBase.OnLoad(e)
Timer1.Start()
End Sub
Protected Overrides Sub OnClosed(ByVal e As System.EventArgs)
MyBase.OnClosed(e)
Timer1.Stop()
End Sub
Private Sub Timer1_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Timer1.Tick
Try
Dim hIMC As Integer
Dim dwConversion As Integer, dwSentence As Integer
Dim rc As Integer
hIMC = ImmGetContext(textBox1.Handle.ToInt32)
'TextBox 한영키 상태값 얻기...
rc = ImmGetConversionStatus(hIMC, dwConversion, dwSentence)
If dwConversion = 0 Then
label1.Text = "한영키 상태 : 영문"
Else
label1.Text = "한영키 상태 : 한글"
End If
Catch ex As Exception
Debug.WriteLine(ex.Message.ToString())
End Try
End Sub
End Class
728x90
'자료' 카테고리의 다른 글
[C#/VB.net]RegisterHotKey - Windows Hotkey 핫키 설정 (0) | 2021.03.17 |
---|---|
[C#/VB.NET] 한글을 자음 모음으로 나누기 & 합치기 (0) | 2021.02.21 |
[VB.net/C#] Interaction.MsgBox(Object, MsgBoxStyle, Object) (0) | 2021.02.20 |
안드로이드 앱 SSL-Pinning 우회 및 패킷 캡처 (0) | 2021.02.08 |
2021년 예비군 원격교육 빠르게 스킵하는방법 (0) | 2021.02.02 |