Hoho,

Many thanks. These code exactly worked.

Why the same code don't have problem in Delphi 7? Can you fix these code to ICS source?

Arno Garrels wrote:
isgbuddy wrote:

You don't need a Chinese windows. You just install East Asian input
method in your windows. Then you will get this issue.

Ok, finally it repeated. The problem is that the thread requires
a message pump if it owns a window. It is _neither_ a problem related to ICS nor to Delphi! You'll see the same freeze when you create a window
by calling Classes.AllocateHwnd(). Uncomment the commented lines below
to make it working:

unit Unit1;

interface

uses
  Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
  Dialogs, StdCtrls;

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

  TTestThread = class(TThread)
  private
    FHandle : HWND;
    procedure WndProc(var MsgRec: TMessage);
  protected
    procedure Execute;override;
  end;

var
  Form1: TForm1;

implementation

{$R *.dfm}

{ TTestThread }
procedure TTestThread.WndProc(var MsgRec: TMessage);
begin
  MsgRec.Result := DefWindowProc(FHandle, MsgRec.Msg, MsgRec.wParam, 
MsgRec.lParam);
end;

procedure TTestThread.Execute;
var
  Msg: TMsg;
begin
  // PeekMessage(Msg, 0, 0, 0, PM_NOREMOVE); // Initialize thread's message 
queue

  FHandle := Classes.AllocateHWnd(WndProc); // Create a hidden window

  {while not Terminated do
  begin
    while PeekMessage(Msg, 0, 0, 0, PM_REMOVE) do
    begin
        if Msg.message = WM_QUIT then
          Terminate
        else begin
          TranslateMessage(Msg);
          DispatchMessage(Msg);
        end;
    end;}

    Sleep(1000);
  end;
end;


procedure TForm1.FormCreate(Sender: TObject);
begin
    with  TTestThread.Create(true) do Resume;
end;

end.
--
To unsubscribe or change your settings for TWSocket mailing list
please goto http://lists.elists.org/cgi-bin/mailman/listinfo/twsocket
Visit our website at http://www.overbyte.be


--
To unsubscribe or change your settings for TWSocket mailing list
please goto http://lists.elists.org/cgi-bin/mailman/listinfo/twsocket
Visit our website at http://www.overbyte.be

Reply via email to