delphi-xe2

How to terminate anonymous threads in Delphi on application close?

旧城冷巷雨未停 提交于 2019-12-18 16:17:32
问题 I have a Delphi application which spawns 6 anonymous threads upon some TTimer.OnTimer event. If I close the application from the X button in titlebar Access Violation at address $C0000005 is raised and FastMM reports leaked TAnonymousThread objects. Which is the best way to free anonymous threads in Delphi created within OnTimer event with TThread.CreateAnonymousThread() method? SOLUTION which worked for me: Created a wrapper of the anonymous threads which terminates them upon being Free-ed.

How do I parse a web URL?

天涯浪子 提交于 2019-12-18 15:04:24
问题 I need to be able to break a URL down into different segments. Take this path for example: http://login:password@somehost.somedomain.com:8080/some_path/something_else.html?param1=val&param2=val#nose \__/ \___/ \______/ \_____________________/ \__/\____________________________/ \___________________/ \__/ | | | | | | | | Scheme Username Password Host Port Path Query Fragment This should break down as follows: Protocol: HTTP Username: login Password: password Host: somehost.somedomain.com Port:

Why are the Delphi zlib and zip libraries so slow under 64 bit?

亡梦爱人 提交于 2019-12-18 14:17:21
问题 Whilst benchmarking a real-world application I came across a surprising performance characteristic relating to the zlib and zip libraries that ship with Delphi. My real-world application exports .xlsx files. This file format is a collection of XML files wrapped in a ZIP container file. The .xlsx export code generates the XML files and then feeds them to the Delphi ZIP library. Once I had optimised the XML file generation to the point where the ZIP creation was the bottleneck I discovered, to

What can I do about maximized, styled windows, which show their borders on adjacent monitors?

馋奶兔 提交于 2019-12-18 11:47:14
问题 On a multi-monitor system, a "blank" VCL application maximizes fine, but the same application with styles enabled (and one chosen as default) maximizes incorrectly. What I'm seeing is the right-hand edge of the window extend onto the 2nd monitor (my main is on the left). When I started comparing to other Windows apps, I noticed that under Windows 7 (at least), maximized windows do not even have non-client borders on the left, right or bottom sides. And indeed, the standard VCL (non-styled)

Update to latest Indy TCP library version

落花浮王杯 提交于 2019-12-18 09:04:45
问题 I'm using DELPHI XE2 since E/2011. I checked now the implemented INDY Lib shipped with my compiler, and found gsIdVersion = '10.5.8.0'; If I want to upgrade to the latest INDY version, I use Indy download link here I found LATEST INDY ZIP FILE. The date of the file is from today, the revision is is less then my installed indy version ID. bevore doing any further action, Can some help me and solve my version number confusion 回答1: According to the subversion repo, the latest revision for Indy

TSQLQuery only streams first 1MB of data correctly for large strings

半城伤御伤魂 提交于 2019-12-18 08:57:14
问题 (see Edit #1 with stack trace and Edit #2 with workaround at end of post) While troubleshooting TSQLQuery.FieldByName().AsString -> TStringStream Corrupts Data, I found that a TSQLQuery.FieldByName().AsBytes will only stream exactly 1MB of varchar(max) data correctly. Using WireShark, I verified that the data is all being handed to the Delphi app correctly . I verified that it always writes out the correct number of bytes to the output file, but any bytes that exceed exactly 1MB are null

How to define “UCHAR * POINTER_32” and “VOID * POINTER_32” types in Delphi?

自作多情 提交于 2019-12-18 08:47:10
问题 Background: Translating the IP_OPTION_INFORMATION32 and ICMP_ECHO_REPLY32 structures for 64-bit compiler I got stucked with data types to use there. Structure definitions from the reference: The IP_OPTION_INFORMATION32 structure: typedef struct _IP_OPTION_INFORMATION32 { UCHAR Ttl; UCHAR Tos; UCHAR Flags; UCHAR OptionsSize; UCHAR * POINTER_32 OptionsData; } IP_OPTION_INFORMATION32, *PIP_OPTION_INFORMATION32; I would translate this way (for Delphi XE2, 64-bit target platform). As you can see,

Conversion with StrToDateTime and TFormatSettings does not work

时光总嘲笑我的痴心妄想 提交于 2019-12-18 03:56:11
问题 This code should work in Delphi XE2, but it gives "not a valid date and time" error in StrtoDateTime conversion: procedure TForm2.Button1Click(Sender: TObject); var s: string; d: TDateTime; FmtStngs: TFormatSettings; begin GetLocaleFormatSettings(GetThreadLocale, FmtStngs); FmtStngs.DateSeparator := #32; FmtStngs.ShortDateFormat := 'dd mmm yyyy'; FmtStngs.TimeSeparator := ':'; FmtStngs.LongTimeFormat := 'hh:nn'; s := FormatDateTime('', Now, FmtStngs); d := StrToDateTime(s, FmtStngs); end; Any

Conversion with StrToDateTime and TFormatSettings does not work

天涯浪子 提交于 2019-12-18 03:56:06
问题 This code should work in Delphi XE2, but it gives "not a valid date and time" error in StrtoDateTime conversion: procedure TForm2.Button1Click(Sender: TObject); var s: string; d: TDateTime; FmtStngs: TFormatSettings; begin GetLocaleFormatSettings(GetThreadLocale, FmtStngs); FmtStngs.DateSeparator := #32; FmtStngs.ShortDateFormat := 'dd mmm yyyy'; FmtStngs.TimeSeparator := ':'; FmtStngs.LongTimeFormat := 'hh:nn'; s := FormatDateTime('', Now, FmtStngs); d := StrToDateTime(s, FmtStngs); end; Any

Setting up a large software system in Delphi

邮差的信 提交于 2019-12-17 22:15:35
问题 We have a software package which is about 16 years old. It's gone through just about every version of Delphi (besides .NET ones). Over the years, things have become very confusing when it comes to cross-referencing and keeping proper setup for additional packages (like third-party libraries). I was wondering if there is some standard practice when it comes to keeping large projects (and groups of projects) like this organized. So to explain the current setup... This is a multi-application