Re: [twsocket] Report a strange problem about using TsslHttpCli(ICSv7)in Delphi 2010 thread.
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
Re: [twsocket] Report a strange problem about using TsslHttpCli(ICSv7)in Delphi 2010 thread.
isgbuddy wrote: 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? My code below does not work with Delphi 7 as well. You probably used ICS V5 with Delphi 7. I guess that the V5 components did not create their hidden window in the constructor but later when the window is actually needed. Using ICS in a thread anyway requires a working message pump, so I don't know whether it was a real improvement if we created the hidden window at some later time. Note that ICS creates one or more hidden windows and once a window is created there must exist a working message pump, otherwise entire application may freeze. -- Arno Garrels 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
Re: [twsocket] Report a strange problem about using TsslHttpCli(ICSv7)in Delphi 2010 thread.
OK. Anyway, Thank for your help. Arno Garrels wrote: isgbuddy wrote: 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? My code below does not work with Delphi 7 as well. You probably used ICS V5 with Delphi 7. I guess that the V5 components did not create their hidden window in the constructor but later when the window is actually needed. Using ICS in a thread anyway requires a working message pump, so I don't know whether it was a real improvement if we created the hidden window at some later time. Note that ICS creates one or more hidden windows and once a window is created there must exist a working message pump, otherwise entire application may freeze. -- Arno Garrels 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 -- 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
Re: [twsocket] Report a strange problem about using TsslHttpCli(ICSv7)in Delphi 2010 thread.
Bricksoft - Frank wrote: No. Create method don't halt. But application is halt. You can try these code in any OS that having Chinese input. I don't have a Chinese Windows installation for testing. What do you mean by Halt? Please be more specific. What Windows version do you use? -- Arno Garrels On Fri, Oct 2, 2009 at 11:04 PM, Arno Garrels arno.garr...@gmx.de wrote: Please let me know if you need any help debug. Please set a breakpoint at sslHttpCli1 := TSslHttpCli.Create(nil); and step through the source (F7). Is there any exception thrown? If yes, post the callstack here. -- Arno Garrels -- 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 -- Frank -- 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
Re: [twsocket] Report a strange problem about using TsslHttpCli(ICSv7)in Delphi 2010 thread.
Hi, I was thinking of Windows being unicode... Isn't it possible to enter Chinese characters with Arial on all Windows'? Regards, SZ On Sat, Oct 3, 2009 at 6:34 PM, Arno Garrels arno.garr...@gmx.de wrote: Bricksoft - Frank wrote: No. Create method don't halt. But application is halt. You can try these code in any OS that having Chinese input. I don't have a Chinese Windows installation for testing. What do you mean by Halt? Please be more specific. What Windows version do you use? -- Arno Garrels On Fri, Oct 2, 2009 at 11:04 PM, Arno Garrels arno.garr...@gmx.de wrote: Please let me know if you need any help debug. Please set a breakpoint at sslHttpCli1 := TSslHttpCli.Create(nil); and step through the source (F7). Is there any exception thrown? If yes, post the callstack here. -- Arno Garrels -- 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 -- Frank -- 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