Delphi

Asynchronous append to .txt file in delphi

谁说我不能喝 提交于 2020-01-03 00:54:12
问题 I'm trying to run a mail server and I want to keep track of the events like login, connect etc.. and I want to save this data in a log .txt file. But since it has to be done asynchronously I don't know how to lock the file for the current data append and then release it for next use. So basically I'm asking for help for a procedure called asyncAppendToFile(fileName : String; textToAppend : String) procedure SMTPServerUserLogin(ASender: TIdSMTPServerContext; const AUsername, APassword: String;

Optimizing TCHart drawing in Delphi 7

久未见 提交于 2020-01-03 00:01:14
问题 My previous question had some great input, but it didn't work for me because my problem seems to be Delphi 7 related. I have a chart with a single series (TFastLineSeries) and 3,600 datapoints which is taking up to 45 seconds to draw. Others have said that it should be lightning fast, so who can help, bearing in mind that I am using Delphi 7 and the standard TChart component. I suspect that instead of calling AddXY() 3,600 times I should be preparing the data first, then adding it all at once

Delphi XE7: How to get native statusbar behavior in iOS 7?

二次信任 提交于 2020-01-02 23:00:12
问题 In iOS 7 the default behavior of the statusbar is to be transparent, but that seems impossible in Delphi XE7. The statusbar always get the same color as the mainform (which was the default behavior in iOS 6). The Mainform.borderstyle controls if the statusbar is shown or not, but I cannot find any way to set it transparent. I have tried setting UIViewControllerBasedStatusBarAppearance and UIStatusBarStyle in the info.plist and tried to call TUIApplication.wrap(TUIApplication.OCClass

read known file extensions / types from the registry

◇◆丶佛笑我妖孽 提交于 2020-01-02 22:03:30
问题 I want to present the user with a list of known file extensions for him to pick. I know that these are stored in the Registry under HKEY_CLASSES_ROOT usually like this: .txt -> (default)="txtfile" where txtfile then contains the information about associated programs etc. Unfortunately that place in the registry also stores lots of other keys, like the file types (e.g. txtfile) and entries like CAPICOM.Certificates (whatever that is) How do I determine which of the entries are file extensions?

XML Namespace in Delphi

折月煮酒 提交于 2020-01-02 22:01:11
问题 I am trying to access some Nodes in my XML File, but I cant get it working because i probably don't understand XML-Namepsaces in Delphi. <gesmes:Envelope xmlns:gesmes="http://www.gesmes.org/xml/2002-08-01" xmlns="http://www.ecb.int/vocabulary/2002-08-01/eurofxref"> <gesmes:subject>Reference rates</gesmes:subject> <gesmes:Sender> <gesmes:name>European Central Bank</gesmes:name> </gesmes:Sender> <Cube> <Cube time="2018-01-18"> <Cube currency="USD" rate="1.2235"/> <Cube currency="JPY" rate="136

Delphi 2010 DeHL Serialization XML and custom attribute : how it work?

落爺英雄遲暮 提交于 2020-01-02 21:47:12
问题 I try to investigate DeHL with Delphi 2010 custom attribute and I get problem. TAppParamTest = class public User: string; Password: string; end; TAppParam = class private FTest: TAppParamTest; public constructor Create; destructor Destroy; override; property Test: TAppParamTest read FTest write FTest; end; this works well : when I serialize I have this <TAppParam xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:DeHL="http://alex.ciobanu

Why does my windows program die with its frozen (bluish gray) Forms or windows?

…衆ロ難τιáo~ 提交于 2020-01-02 20:25:15
问题 My delphi program (NOT for .NET) on windows 7 seems to be running for couple of days straight and then the program sort of freezes with all of its windows painted with blueish grey color as if its windows are disabled. You simply don't have control over the program anymore but has to kill its process and start it up again. You don't need to reboot the system itself. Has anyone experience this or anything similar? If so, what did you do to resolve or try to resolve it? Thanks, 回答1: The bluish

Delphi GetClass

一个人想着一个人 提交于 2020-01-02 20:13:30
问题 My question is how to access a class which is in an other unit? For an example: program Project1; {$APPTYPE CONSOLE} uses SysUtils, Classes, System, StrUtils, Math, TypInfo, Data in 'Data.pas'; var Str, name, value : string; List, tmpList : TStringList; i : Integer; Obj : TObject; CRef : TPersistentClass; d : TData; begin d := TData(GetClass('Data.TData').Create); Writeln(Format('%s', [d.Name])); Readln; Readln; end. And the Data unit : unit Data; interface uses SysUtils, Classes; type TData

Basic email validation within Inno Setup script

試著忘記壹切 提交于 2020-01-02 18:26:00
问题 I'm wanting to do a basic string validation within an Inno Setup script to be relatively certain the string is an email address. I just want to see that there is a '@' character followed by a '.' character and that there is at least one character on either side of these. Something similar to this regular expression: [^@]+@.+\.[^\.] The lack of regular expressions and limited string functions available in object pascal are causing me grief. It would be simple enough to reverse the string, find

How to send email with attachment using default Android email app - Delphi XE7

两盒软妹~` 提交于 2020-01-02 18:07:12
问题 Using code below which I found on another post, the email appears ready to send with the attachment, but when email is received, there is no attachment. Also, the email address has to be manually entered, it is not populated by the CreateEmail statement. I am sending from a gmail account. Anyone help please? procedure TForm1.CreateEmail(const Recipient, Subject, Content, Attachment: string); var Intent: JIntent; Uri: Jnet_Uri; AttachmentFile: JFile; begin Intent := TJIntent.Create; Intent