Recently encountered the program to open the thread, in the main interface edit box switch Input method, the program is stuck, only forced to close

Source: Internet
Author: User

functionTCFADODBStorage.OpenConnection:Boolean; //thread open adoconnection, in XP switch IME program will die  //cause: ADO automatically creates a Adodb.asynceventmessenger window, and then there is a corresponding IME window, but there is no message loop in the thread  //XP When the IME switch is sendmessage to the IME window and waits to be returned, the IME window does not process messages, causing deadlocks  //This function frees the IME window of the line thread, and when switching the IME, there is no message coming.  procedure_freeimewindow; ConstIme_window_class='IME'; Ime_window_text='Default IME'; varH:hwnd;    Pid:dword;  Dh:hwnd; beginh:=FindWindow (Ime_window_class, Ime_window_text);  whileIsWindow (h) Do    begin      ifGetWindowThreadProcessId (h, pid) = GetCurrentThreadID ThenDH:=hElseDH:=0; H:= FindWindowEx (0, H, Ime_window_class, Ime_window_text); ifDH <>0  ThenDestroyWindow (DH); End; End;begin  Tryfconnection.connectionstring:=ConnectionString; Fconnection.connected:=True; ifGetCurrentThreadID <> Global.mainthreadid{the global main thread ID, if it is the main thread, does not require free}  Then_freeimewindow; exceptOn E:exception DoFlasterrormessage:=E.message; End; Result:=fconnection.connected;End;

Recently encountered the program to open the thread, in the main interface edit box switch Input method, the program is stuck, only forced to close

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.