delphi-5

Delphi: What is Application.Handle?

本小妞迷上赌 提交于 2019-12-17 21:43:57
问题 What is TApplication.Handle ? Where does it come from? Why does it exist? And most importantly: why do all forms have it as their parent window handle? The Delphi help says: TApplication.Handle Provides access to the window handle of the main form (window) of the application. property Handle: HWND; Description Use Handle when calling Windows API functions that require a parent window handle. For example, a DLL that displays its own top-level pop-up windows needs a parent window to display its

TWebBrowser crashes with embedded Youtube clips

杀马特。学长 韩版系。学妹 提交于 2019-12-17 19:47:42
问题 Here is my code: type TForm1 = class(TForm) WebBrowser1: TWebBrowser; Button1: TButton; Button2: TButton; procedure Button1Click(Sender: TObject); procedure Button2Click(Sender: TObject); end; implementation uses ActiveX; procedure TForm1.Button1Click(Sender: TObject); // method 1 var HtmlFile: string; begin HtmlFile := ExtractFilePath(Application.ExeName) + 'test.html'; WebBrowser1.Navigate(HtmlFile); end; procedure LoadHtml(wb: TWebBrowser; HTMLStr: string); var aStream: TMemoryStream;

Delphi: Understanding constructors

喜你入骨 提交于 2019-12-17 08:25:25
问题 i'm looking to understand virtual override overload reintroduce when applied to object constructors. Every time i randomly add keywords until the compiler shuts up - and (after 12 years of developing with Delphi) i'd rather know what i'm doing, rather than trying things randomly. Given a hypothetical set of objects: TComputer = class(TObject) public constructor Create(Cup: Integer); virtual; end; TCellPhone = class(TComputer) public constructor Create(Cup: Integer; Teapot: string); virtual;

Delphi: Understanding constructors

妖精的绣舞 提交于 2019-12-17 08:25:16
问题 i'm looking to understand virtual override overload reintroduce when applied to object constructors. Every time i randomly add keywords until the compiler shuts up - and (after 12 years of developing with Delphi) i'd rather know what i'm doing, rather than trying things randomly. Given a hypothetical set of objects: TComputer = class(TObject) public constructor Create(Cup: Integer); virtual; end; TCellPhone = class(TComputer) public constructor Create(Cup: Integer; Teapot: string); virtual;

Converting a string to TDateTime based on an arbitrary format

可紊 提交于 2019-12-17 06:46:17
问题 Is there any way in Delphi 5 to convert a string to a TDateTime where you can specify the actual format to use? I'm working on a jobprocessor, which accepts tasks from various workstations. The tasks have a range of parameters, some of which are dates, but (unfortunately, and out of my control) they're passed as strings. Since the jobs can come from different workstations, the actual datetime format used to format the dates as a string might (and, of course, actual do ) differ. Googling

How to parameterize widestrings using TADOCommand parameterized query?

故事扮演 提交于 2019-12-13 21:00:21
问题 i am trying to use a parameterized query with Delphi TADOCommand: var s: WideString; cmd: TADOCommand; recordsAffected: OleVariant; begin cmd := TADOCommand.Create(nil); cmd.Connection := Connection; cmd.CommandText := 'INSERT INTO Sqm(Filename) VALUES(:filename)'; s := AFilename; cmd.Parameters.ParamByName('filename').Value := s; cmd.Execute(); The resulting data in the database is complete mangled: C?:\U?s?er?s?\i??n?.A?V`A?T?O?P?I?A?\A?p?p?D??t??\L?o???l?\A?v?at??r? S?o?f?t?w?är¨? C?r??t?i

Download CSV in Delphi 5 with Indy

青春壹個敷衍的年華 提交于 2019-12-13 04:51:14
问题 I know there's alot of Indy threads but I can't get one to match my case. I have been given a URL with a username and password form. this then actions to a URL/reports.php on which there are multiple hyperlinks. Each of these links will direct to a page with URL variables e.g. reports.php?report=variablename where a download will immediately start. My thinking so far: procedure TForm1.PostData(Sender: TObject); var paramList:TStringList; url,text:string; // IdHTTP1: TIdHTTP;

Resize png image in Delphi - incorrect alpha channel

三世轮回 提交于 2019-12-12 13:50:11
问题 I am resizing png images which might have alpha channel. Everything works good, with one exception: I get some gray pixels around the transparent areas. The original image doesn't have any drop shadows. Is there a way to fix this / work it around? I am using SmoothResize by Gustavo Daud (See the first answer to this question), to resize the png image. I cannot provide the code that I am using as I did not write it and do not have the author's permission to publish it. 回答1: I suspect that is

check box in TListView header column - How to prevent it from stealing focus?

社会主义新天地 提交于 2019-12-12 07:57:01
问题 This is related to the question How to show a check box in TListView header column?. I want to use the code from this answer by @Sertac Akyuz . (I need this to work in WinXP also) But I want to make the header CheckBox to not steal focus from the ListView or other active controls. A fast workaround is to set the focus always to the ListView in the ListHeaderWndProc : ... FListHeaderChk.Checked := not FListHeaderChk.Checked; ListView1.SetFocus; // code that checks/clears all items But this is

Why AddGantt or AddGanttColor returns the same index for different invocations?

二次信任 提交于 2019-12-12 04:24:47
问题 For some reason for certain cases when adding gantts to a TGanttSeries instance using method AddGanttColor or AddGantt the same index is returned for two different calls. For example, the following snippet illustrates the case where the last two calls both return index of value 1. Series.AddGanttColor(0, 100, 0, 'WA #234', clGreen); // returns value 0 Series.AddGanttColor(100, 200, 1, 'WA #235', clGreen); // returns value 1 Series.AddGanttColor(50, 200, 2, 'WA #237', clGreen); // returns