â^úuÌTCgÅ·ªA��ÎÉ�}�}ÜÅúÁÄ�NÌÍ�}©Cܸ��ÌÅêq��IÉXVBÔÍǤÆÅà·éñÅ·ªAǤÉàSÌÕüÉGêél^ª³ï¿½ï¿½ñÅ·æË\ccB
³ÄA¡ñÌXVÍ^f¦ÂÉqgð¾ÄAIME ðgpµÄÌüͩǤ©æ¾·éNXÅ·BüͩǤ©ÌóÔªÏíÁ½ÉÍCxgð��³¹Ü·BÆ;ÁÄà²ÈPÆ��¤©è²«ÅAWM_IME_STARTCOMPOSITION Æ WM_IME_ENDCOMPOSITION ðĵÄ��龯ŷÌÅACX^X����Éü;Á½êÍêUüͪI¹·éÜųµï¿½ï¿½lðԵܹñB
¡ñÌ\[XÌZpIÈðàðXB
WM_IME_STARTCOMPOSITION / WM_IME_ENDCOMPOSITION bZ[WÍAÀÛÉüÍÌRg[ÉεÄM³êÜ·BÂÜèAÊÉâë¤Æ·éÆAgp·éSÄÌüÍpRg[ÉÂ��Äh��Rg[ðpÓ·é© NativeWindow ðpӷ驵ÄbZ[WðßܦÈÄÍÈèܹñB»µÄ»êÍ»ÀIÅÍÈ��ŵå¤B¡ñÍ»Ìâèðð·é½ßAbZ[WðóM·éå³Åßܦéæ¤ÉµÄ��ܷB»êª IMessageFilter C^[tFCXÅ·B
IMessageFilter ðÀµ½NXð Application.AddMessageFilter \bhÅo^·éÉæèAAvP[VÉi½ªµï¿½ï¿½ÉÍAvP[VReLXgÌXbhbZ[WL [ÉjM³ê½bZ[WÉεÄAAvP[Vª·éOieRg[ÖéOjÉÆ©ð{·ªÂ\ÉÈèÜ·B
¿ÈÝÉAIMessageFilter Í[_/[hX_CAOÈÇÉÂ��ÄàLøÅ·ªAÊXbhÅì��³ê½Rg[ÉÂ��Ä͵¦Ü¹ñBÜ AÊÍ»à»à»ñÈRgµÈ��ŵ太B
¡ñÌ\[XÍJX^Cxgðg¦È�� VB7.0/7.1iVB2002/2003jÍεÄ��ܹñBÜ Component.Events ªg¦È��¾¯Å·ÌÅA»ÌüÓðJX^Cxg��áÈÄÊÌCxgÅ·éæ¤É·êÎÚAÍïµï¿½ï¿½ÅÍÈ��ŵå¤B
// C# using System; using System.ComponentModel; using System.Windows.Forms; namespace HongliangSoft.Utilities.IO { [DefaultEvent("ConversionChanged")] public class ImeStatus : Component, IMessageFilter { public ImeStatus() { Application.AddMessageFilter(this); } public ImeStatus(IContainer container) : this() { if (container != null) container.Add(this); } private static readonly object EventConversionChanged = new object(); private bool isConversion = false; [Browsable(false)] public bool IsConversion { get { return this.isConversion; } } public event EventHandler ConversionChanged { add { this.Events.AddHandler(EventConversionChanged, value); } remove { this.Events.RemoveHandler(EventConversionChanged, value); } } protected override void Dispose(bool disposing) { if (disposing) { Application.RemoveMessageFilter(this); } base.Dispose(disposing); } public bool PreFilterMessage(ref Message m) { const int WmStartComposition = 0x10D; const int WmEndComposition = 0x10E; switch (m.Msg) { case WmStartComposition : this.isConversion = true; OnConversionChanged(EventArgs.Empty); break; case WmEndComposition : this.isConversion = false; OnConversionChanged(EventArgs.Empty); break; } return false; } protected virtual void OnConversionChanged(EventArgs e) { EventHandler handler = this.Events[EventConversionChanged] as EventHandler; if (handler != null) handler(this, e); } } }
' VB8.0 Imports System Imports System.ComponentModel Imports System.Windows.Forms Namespace HongliangSoft.Utilities.IO <DefaultEvent("ConversionChanged")> _ Public Class ImeStatus Inherits Component Implements IMessageFilter Public Sub New() Application.AddMessageFilter(Me) End Sub Public Sub New(ByVal container As IContainer) If container IsNot Nothing Then container.Add(Me) End If End Sub Private ReadOnly Shared EventConversionChanged As New Object() Private m_isConversion As Boolean = False <Browsable(False)> _ Public ReadOnly Property IsConversion() As Boolean Get Return Me.m_isConversion End Get End Property Public Custom Event ConversionChanged As EventHandler AddHandler(ByVal value As EventHandler) Me.Events.AddHandler(EventConversionChanged, value) End AddHandler RemoveHandler(ByVal value As EventHandler) Me.Events.RemoveHandler(EventConversionChanged, value) End RemoveHandler RaiseEvent(ByVal sender As Object, ByVal e As EventArgs) Dim handler As EventHandler = _ TryCast(Me.Events(EventConversionChanged), _ EventHandler) If handler IsNot Nothing Then handler(sender, e) End If End RaiseEvent End Event Protected Overrides Sub Dispose(ByVal disposing As Boolean) If disposing Then Application.RemoveMessageFilter(Me) End If MyBase.Dispose(disposing) End Sub Public Function PreFilterMessage(ByRef m As Message) As Boolean _ Implements IMessageFilter.PreFilterMessage Const WmStartComposition As Integer = &H10D Const WmEndComposition As Integer = &H10E Select Case m.Msg Case WmStartComposition Me.m_isConversion = True Me.OnConversionChanged(EventArgs.Empty) Case WmEndComposition Me.m_isConversion = False Me.OnConversionChanged(EventArgs.Empty) End Select Return False End Function Protected Overridable Sub OnConversionChanged(ByVal e As EventArgs) RaiseEvent ConversionChanged(Me, e) End Sub End Class End Namespace