delphi-7

Why does my program crash when I destroy a button in its own OnClick handler?

霸气de小男生 提交于 2019-12-18 08:34:46
问题 I tried a script from a web site I run http://www.delphi-central.com/runtime.aspx and succeed. private { Private declarations } procedure CustomButtonClick(Sender: TObject); procedure TForm1.AddNewButtonClick(Sender: TObject); var NewButton : TButton; begin NewButton := TButton.create(self); with NewButton do begin Top := 30; Width := 60; Left := Width * (self.ControlCount-2); Parent := self; OnClick := CustomButtonClick; Caption := 'Button '+ inttostr (self.ControlCount-2); end; //With end;

Why does my program crash when I destroy a button in its own OnClick handler?

半世苍凉 提交于 2019-12-18 08:32:31
问题 I tried a script from a web site I run http://www.delphi-central.com/runtime.aspx and succeed. private { Private declarations } procedure CustomButtonClick(Sender: TObject); procedure TForm1.AddNewButtonClick(Sender: TObject); var NewButton : TButton; begin NewButton := TButton.create(self); with NewButton do begin Top := 30; Width := 60; Left := Width * (self.ControlCount-2); Parent := self; OnClick := CustomButtonClick; Caption := 'Button '+ inttostr (self.ControlCount-2); end; //With end;

Why does my program crash when I destroy a button in its own OnClick handler?

旧时模样 提交于 2019-12-18 08:32:20
问题 I tried a script from a web site I run http://www.delphi-central.com/runtime.aspx and succeed. private { Private declarations } procedure CustomButtonClick(Sender: TObject); procedure TForm1.AddNewButtonClick(Sender: TObject); var NewButton : TButton; begin NewButton := TButton.create(self); with NewButton do begin Top := 30; Width := 60; Left := Width * (self.ControlCount-2); Parent := self; OnClick := CustomButtonClick; Caption := 'Button '+ inttostr (self.ControlCount-2); end; //With end;

delphi mergesort for string arrays [closed]

ε祈祈猫儿з 提交于 2019-12-18 07:24:21
问题 It's difficult to tell what is being asked here. This question is ambiguous, vague, incomplete, overly broad, or rhetorical and cannot be reasonably answered in its current form. For help clarifying this question so that it can be reopened, visit the help center. Closed 7 years ago . Found this coded mergesort on http://www.explainth.at/en/delphi/dsort.shtml (site down but try wayback machine or this site: http://read.pudn.com/downloads192/sourcecode/delphi_control/901147/Sorts.pas__.htm) but

How to save only a particular item in the tstringlist to a file

跟風遠走 提交于 2019-12-18 07:21:42
问题 Here is my code. var filehan : Textfile; i : Integer; LineOfText : String; tsl : TStringList; Name, Emp_id : string; begin stf := TStringList.create; Assignfile ( filehan, 'EMP.txt'); Reset ( filehand ); While not EOF(filehan) do begin inc(i); ReadLn ( filehan, LineOfText ); tsl :=substrings(LineOfText, ':' ); Name := tsl[1]; Emp_id := tsl[0]; tsl.SaveToFile('FSTRING.txt'); end; CloseFile (FFile); end; function SubStrings(AString: String; ADelimiter: Char): TStringList; var sList :

How to save only a particular item in the tstringlist to a file

痞子三分冷 提交于 2019-12-18 07:19:28
问题 Here is my code. var filehan : Textfile; i : Integer; LineOfText : String; tsl : TStringList; Name, Emp_id : string; begin stf := TStringList.create; Assignfile ( filehan, 'EMP.txt'); Reset ( filehand ); While not EOF(filehan) do begin inc(i); ReadLn ( filehan, LineOfText ); tsl :=substrings(LineOfText, ':' ); Name := tsl[1]; Emp_id := tsl[0]; tsl.SaveToFile('FSTRING.txt'); end; CloseFile (FFile); end; function SubStrings(AString: String; ADelimiter: Char): TStringList; var sList :

detect usb drive/device using delphi

主宰稳场 提交于 2019-12-18 07:15:43
问题 i can't figure out the formatting rules here .. too many lines of code in my example to add 4 spaces to each line, so here is the link to the code i need help with http://nitemsg.blogspot.com/2011/01/heres-unit-written-in-delphi-7-that-you.html The problem I have is that I don't know enough about delphi to use this code with a form. I am a drag and drop programmer only. An example with a showmessage('friendly name =' + ... ) when a USB device is detected is what I need. cheers, 回答1: If you

Thread.FreeOnTerminate := True, memory leak and ghost running

余生颓废 提交于 2019-12-18 05:43:10
问题 Years ago, I decided never to rely solely on setting a thread's FreeOnTerminate property to true to be sure of its destruction, because I discovered and reasoned two things at application's termination: it produces a memory leak, and after program's termination, the thread is still running somewhere below the keyboard of my notebook. I familiarized myself with a workaround, and it did not bother me all this time. Until tonight, when again someone (@MartinJames in this case) commented on my

Thread.FreeOnTerminate := True, memory leak and ghost running

橙三吉。 提交于 2019-12-18 05:43:04
问题 Years ago, I decided never to rely solely on setting a thread's FreeOnTerminate property to true to be sure of its destruction, because I discovered and reasoned two things at application's termination: it produces a memory leak, and after program's termination, the thread is still running somewhere below the keyboard of my notebook. I familiarized myself with a workaround, and it did not bother me all this time. Until tonight, when again someone (@MartinJames in this case) commented on my

How can I get HTML source code from TWebBrowser

☆樱花仙子☆ 提交于 2019-12-18 04:42:42
问题 How can I get source code from WebBrowser component? I want to get source code of active page on WebBrowser component and write it to a Memo component. Thanks. 回答1: You can use the IPersistStreamInit Interface and the save method to store the content of the Webbrowser in a Stream. Uses ActiveX; function GetWebBrowserHTML(const WebBrowser: TWebBrowser): String; var LStream: TStringStream; Stream : IStream; LPersistStreamInit : IPersistStreamInit; begin if not Assigned(WebBrowser.Document) then