-
Notifications
You must be signed in to change notification settings - Fork 5
Expand file tree
/
Copy pathTextBox2.fs
More file actions
27 lines (24 loc) · 1005 Bytes
/
TextBox2.fs
File metadata and controls
27 lines (24 loc) · 1005 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
namespace Sayuri.Windows.Forms
open System.Runtime.InteropServices
open System.Windows.Forms
type TextBox2 () =
inherit TextBox ()
[<DllImport "Imm32.dll">]
static extern nativeint ImmGetContext(nativeint hWnd)
[<DllImport "Imm32.dll">]
static extern bool ImmGetOpenStatus(nativeint hIMC)
[<DllImport "Imm32.dll">]
static extern bool ImmNotifyIME(nativeint hIMC, uint32 dwAction, uint32 dwIndex, uint32 dwValue)
[<DllImport "Imm32.dll">]
static extern bool ImmReleaseContext(nativeint hWnd, nativeint hIMC)
[<Literal>]
static let NI_SELECTCANDIDATESTR = 0x0015u
[<Literal>]
static let CPS_COMPLETE = 0x0001u
override this.OnLostFocus e =
let context = ImmGetContext this.Handle
if context <> 0n then
if ImmGetOpenStatus context then
ImmNotifyIME(context, NI_SELECTCANDIDATESTR, CPS_COMPLETE, 0u) |> ignore
ImmReleaseContext(this.Handle, context) |> ignore
base.OnLostFocus e