반응형
* VBNET API 를 이용한 한/영 키 상태 값 얻어 오기 예제...
전체 소스 코드
Form1.vb
Imports System.Runtime.InteropServices
Public Class Form1
'API 선언...
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
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
*예제 결과
https://kdsoft-zeros.tistory.com/160
반응형
'VB.NET Programming' 카테고리의 다른 글
[VBNET] [API] Mouse Cursor Move And AutoClick Event (0) | 2020.03.12 |
---|---|
[VBNET] [API] 마우스 커서 좌표 얻어오기 (0) | 2020.03.10 |
[VBNET] 윈도우 폼(Window Form) - 폼(Form) 화면 그대로 프린트(Print) (0) | 2020.03.04 |
[VBNET] [WMI] 네트워크 IP 및 Subnet, Gateway Set (0) | 2020.03.02 |
[VBNET] [WMI] 네트워크 IP 및 Subnet, Gateway 얻어오기 (0) | 2020.02.27 |