Delphi

Delphi Indy no response content after 404

北城以北 提交于 2020-01-20 08:16:52
问题 When Indy get a 404, I cannot get the response content, its always empty. For example, using Indy to access https://www.etsy.com/people/car, I get a 404 and contentstream (or assigned stream) is just empty. Doing the same with THttpClient, I also get a 404, but also get the content of the 404 page in the response stream. So my question is, how can I get the response content with Indy when its a 404? 回答1: using Indy to access https://www.etsy.com/people/car, I get a 404 and contentstream (or

Delphi Indy no response content after 404

岁酱吖の 提交于 2020-01-20 08:15:06
问题 When Indy get a 404, I cannot get the response content, its always empty. For example, using Indy to access https://www.etsy.com/people/car, I get a 404 and contentstream (or assigned stream) is just empty. Doing the same with THttpClient, I also get a 404, but also get the content of the 404 page in the response stream. So my question is, how can I get the response content with Indy when its a 404? 回答1: using Indy to access https://www.etsy.com/people/car, I get a 404 and contentstream (or

TRttiMethod.Invoke function doesn't work in overloaded methods?

空扰寡人 提交于 2020-01-20 05:05:15
问题 I'm creating an instance of a class using the TRttiMethod.Invoke function , but when the constructor or a method is overloaded, the rtti does not call the proper method. I wrote a sample app to ilustate my problem. program ProjectFoo; {$APPTYPE CONSOLE} {$R *.res} uses Rtti, System.SysUtils; type TFoo=class public constructor Create(Value : Integer);overload; constructor Create(const Value : string);overload; function Bar(value : integer) : Integer; overload; function Bar(const value : string

TRttiMethod.Invoke function doesn't work in overloaded methods?

浪尽此生 提交于 2020-01-20 05:04:45
问题 I'm creating an instance of a class using the TRttiMethod.Invoke function , but when the constructor or a method is overloaded, the rtti does not call the proper method. I wrote a sample app to ilustate my problem. program ProjectFoo; {$APPTYPE CONSOLE} {$R *.res} uses Rtti, System.SysUtils; type TFoo=class public constructor Create(Value : Integer);overload; constructor Create(const Value : string);overload; function Bar(value : integer) : Integer; overload; function Bar(const value : string

Focus next control on enter - in overridden KeyUp

喜夏-厌秋 提交于 2020-01-20 03:24:25
问题 I have my custom class that extends TEdit: TMyTextEdit = class (TEdit) private fFocusNextOnEnter: Boolean; public procedure KeyUp(var Key: Word; Shift :TShiftState); override; published property FocusNextOnExnter: Boolean read fFocusNextOnEnter write fFocusNextOnEnter default false; end; In The KeyUp procedure I do: procedure TMyTextEdit.KeyUp(var Key: Word; Shift: TShiftState); begin inherited; if FocusNextOnExnter then if Key = VK_RETURN then SelectNext(Self as TWinControl, True, false);

Indy - IdHttp how to handle page redirects?

允我心安 提交于 2020-01-19 07:58:47
问题 Using: Delphi 2010, latest version of Indy I am trying to scrape the data off Googles Adsense web page, with an aim to get the reports. However I have been unsuccessful so far. It stops after the first request and does not proceed. Using Fiddler to debug the traffic/requests to Google Adsense website, and a web browser to load the Adsense page, I can see that the request (from the webbrowser) generates a number of redirects until the page is loaded. However, my Delphi application is only

Form is hidden behind other forms when ShowModal is called

社会主义新天地 提交于 2020-01-19 04:46:13
问题 My application is based on modal forms. Main form opens one form with ShowModal, this form opens another with ShowModal, so we have stacked modal forms. There is sometimes a problem that when we call ShowModal in new form, it hides behind previous forms, instead of showing on top. After pressing alt+tab, form comes back to the top, but this is not good solution. Did You meet this problem and how did you handle it? EDIT : I use Delphi 7. 回答1: You didn't mention which version of Delphi... Newer

Force system with nVidia Optimus to use the real GPU for my application?

泄露秘密 提交于 2020-01-19 04:02:21
问题 I want my application to always run using the real gpu on nVidia Optimus laptops. From "Enabling High Performance Graphics Rendering on Optimus Systems", (http://developer.download.nvidia.com/devzone/devcenter/gamegraphics/files/OptimusRenderingPolicies.pdf): Global Variable NvOptimusEnablement (new in Driver Release 302) Starting with the Release 302 drivers, application developers can direct the Optimus driver at runtime to use the High Performance Graphics to render any application–even

Force system with nVidia Optimus to use the real GPU for my application?

随声附和 提交于 2020-01-19 04:02:13
问题 I want my application to always run using the real gpu on nVidia Optimus laptops. From "Enabling High Performance Graphics Rendering on Optimus Systems", (http://developer.download.nvidia.com/devzone/devcenter/gamegraphics/files/OptimusRenderingPolicies.pdf): Global Variable NvOptimusEnablement (new in Driver Release 302) Starting with the Release 302 drivers, application developers can direct the Optimus driver at runtime to use the High Performance Graphics to render any application–even

Delphi中TStringList类用法

ε祈祈猫儿з 提交于 2020-01-18 09:15:44
TStrings 是一个抽象类 TStringList 是由TStrings派生而来, TStrings 继承于Tpersistent类。 TStringList 常用方法与属性 var List: TStringList; i: Integer; begin List := TStringList.Create; List.Add('Strings1'); {添加} List.Add('Strings2'); List.Exchange(0,1); {置换} List.Insert(0,'Strings3'); {插入} i := List.IndexOf('Strings1'); {第一次出现的位置} List.Sort; {排序} List.Sorted := True; {指定排序} List.Count; {总数} List.Text; {文本集合} List.Delete(0); {删除, 0是第一个数据} List.LoadFromFile('c:\tmp.txt');{打开} List.SaveToFile('c:\tmp.txt'); {保存} List.Clear; {清空} List.Free; {释放} end; // 类似的哈希表操作法 var List: TStringList; begin List := TStringList.Create;