TMSQuery conflict with the IME(Input Method Editor) ?

Discussion of open issues, suggestions and bugs regarding SDAC (SQL Server Data Access Components) for Delphi, C++Builder, Lazarus (and FPC)
Post Reply
visli
Posts: 5
Joined: Wed 15 Dec 2004 06:37

TMSQuery conflict with the IME(Input Method Editor) ?

Post by visli » Mon 03 Mar 2008 02:19

Hi,
I created a TMSQuery component in my subthread,
when I press Ctrl + Shift or Ctrl + Space (input method switching), will cause the program to stops responding.

Code: Select all

unit Unit1;

interface

uses
  Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
  Dialogs, ActiveX, StdCtrls, DB, MemDS, DBAccess, MSAccess;

type
  TForm1 = class(TForm)
    Button1: TButton;
    Edit1: TEdit;
    Button2: TButton;
    procedure Button1Click(Sender: TObject);
    procedure Button2Click(Sender: TObject);
  private
    { Private declarations }
  public
    { Public declarations }
  end;

  TDBThread = class(TThread)
  private
  protected
    procedure Execute; override;
  public
    constructor Create;
  end;

var
  Form1: TForm1;
  DBThread: TDBThread;

implementation

{$R *.dfm}

constructor TDBThread.Create;
begin
  inherited Create(False);
  FreeOnTerminate := True;
end;

procedure TDBThread.Execute;
var
  DBQuery: TMSQuery;
begin
  if CoInitializeEx(nil, COINIT_APARTMENTTHREADED)  S_OK then
    raise Exception.Create(SysErrorMessage(GetLastError));

  DBQuery := TMSQuery.Create(nil);
  try
    while not Terminated do
      Sleep(500);
  finally
    DBQuery.Free;
    CoUninitialize;
  end;
end;

procedure TForm1.Button1Click(Sender: TObject);
begin
  DBThread := TDBThread.Create;
end;

procedure TForm1.Button2Click(Sender: TObject);
begin
  DBThread.Terminate;
end;

end.
PS.
I used Spy++ found that when creating TMSQuery components, will create an implied "TOraAlerterWindow" Window and a "Default IME" window.
, Windows will send a series of WM_IME_* messages to IME window(by SendMessage) When I press Ctrl + Shift or Ctrl + Space.

My OS: Windows XP Pro + SP2 (Simplified Chinese version)

Regards
Visli

Antaeus
Posts: 2098
Joined: Tue 14 Feb 2006 10:14

Post by Antaeus » Tue 04 Mar 2008 11:43

Try to download the last build of SDAC (4.35.1.15), and avoid using the AutoRefresh option.

Post Reply