function TCFADODBStorage.OpenConnection: Boolean;
procedure _FreeIMEWindow;
const
IME_WINDOW_CLASS = ‘IME‘;
IME_WINDOW_TEXT = ‘Default IME‘;
var
h : HWND;
pid : DWORD;
dh : HWND;
begin
h := FindWindow(IME_WINDOW_CLASS, IME_WINDOW_TEXT);
while IsWindow(h) do
begin
if GetWindowThreadProcessId(h, pid) = GetCurrentThreadId then
dh := h
else
dh := 0;
h := FindWindowEx(0, h, IME_WINDOW_CLASS, IME_WINDOW_TEXT);
if dh <> 0 then
DestroyWindow(dh);
end;
end;
begin
try
FConnection.ConnectionString := ConnectionString;
FConnection.Connected := True;
if GetCurrentThreadId <> Global.MainThreadID then
_FreeIMEWindow;
except on E: Exception do
FLastErrorMessage := e.Message;
end;
Result := FConnection.Connected;
end;