LoginSignup
0
0

More than 5 years have passed since last update.

Xojoでキーボードレイアウトを判別

Last updated at Posted at 2015-12-24

Xojoでキーボードレイアウトを判別するメソッドです。
OS Xデスクトップアプリ専用。

Function GetKeyboardLayout() As String

  declare function LMGetKbdType lib "Carbon" () as Integer
  declare function KBGetLayoutType lib "Carbon" (iKeyboardType as Integer) as OSType

  dim v as Variant = KBGetLayoutType(LMGetKbdType)

  Select case v.StringValue

  case "JIS "
    Return "JIS"

  case "ANSI"
    Return "US"

  case "ISO "
    Return "International"

  case "????"
    Return "Unknown"

  End Select

End Function

Carbonですけど、Cocoaビルドでも大丈夫。

0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0