4 votes
Accepted

Sending a string from anonymous thread to UI with PostMessage

Create an object containing the string as a property and pass the pointer to the object as Integer LParam. Then, in the message ...
user1580348's user avatar
4 votes
Accepted

Noughts and crosses bot in Delphi

I find it a little cocky that you understand that people might have issues with non-meaning variable names and undocumented functions, but are not prepared to put down a little work to remove those ...
Tom Brunberg's user avatar
4 votes

Dephi: faster way to convert a "dirty" string to a number

Don't over use set. It is faster when the items are discrete, but slower when the items are continuous. Although, the difference is very small in your case. The ...
W. Chang's user avatar
  • 379
3 votes
Accepted

Dephi: faster way to convert a "dirty" string to a number

Practically speaking, this function is probably not the single bottleneck of your application, which would mean it takes more than 30% of the total run time. Therefore you don't need to optimize this ...
Roland Illig's user avatar
  • 21.3k
3 votes
Accepted

Enumerating RCData resources from the EXE file which has been launched

The code is mostly fine but there a couple of minor issues: The documentation for EnumResNameProc explains that lpszType and <...
David Heffernan's user avatar
3 votes

Resumable download with System.net.HTTPClient

Your code looks pretty good to me. Just a few quick notes: There is an Exception.CreateFmt constuctor you can use. For example: ...
Dangph's user avatar
  • 1,683
2 votes
Accepted

Flipping True or False values to save typing and time

I'd replace the if-then-elses with DBGrid1.Columns[i].Visible := not DBGrid1.Columns[i].Visible - i.e. use the not keyword ...
Ulrich Gerhardt's user avatar
2 votes

Delphi 2009 interface

I suggest to check around TSync as it inherits from TInterfacedObject, which is reference counted, a typical source of memory ...
thesyndarn's user avatar
2 votes

Converting Delphi colors between TColor, RGB, CMYK, and HSV

Putting this statement before S := S / 255, makes the record consistent for handling HSV: ...
user30478's user avatar
  • 121
2 votes
Accepted

Generic function for loading a function from a DLL library

Just like Dangph, I wonder why you need this. There are other better approaches suggested in the previous comments. Even if this is useful, Your solution is not great: 1. You repeatedly load the ...
W. Chang's user avatar
  • 379
2 votes
Accepted

Delphi - did I understand callbacks correctly?

This question belongs to StackOverflow but not StackExchange. The title is also misleading, as you're asking about the call to application.ProcessMessages but not ...
W. Chang's user avatar
  • 379
2 votes

Delphi function to canonicalize the capitalization in a file path

As many Windows API functions work since 90's - you can call a function with zero size buffer first - function will fail, but will return needed buffer size, then you create your buffer with required ...
Miroslav Penchev's user avatar
1 vote

Configurable 'swapping' order of loops

I don't speak the language you are using so I won't try coding in it, but I would have thought you could simplify the code by something like ...
Peter Jennings's user avatar
1 vote
Accepted

Efficiently calculate the value of an arithmetic sequence

Seems trivial. Pair them, each pair is worth -1. ...
superb rain's user avatar
  • 3,991
1 vote
Accepted

Basic Color class for both Delphi and Lazarus

Self-review Randomize missing Since I use Random to generate pseudo-random color, it is, I lightly remember, a must to call <...
Vlastimil Burián's user avatar
1 vote

IsValidEmailAddress

I think there are some emails that will be invalid with your function. Like this: [email protected] (when a domain name is more than 6 ...
Kate Lobatenko's user avatar
1 vote

Make it easier with color changing

Set the ParentFont property of each label to true in the IDE object inspector. Then just set the Font property of their parent control (i.e. the Form or Panel they live in ). E.g: ...
Reversed Engineer's user avatar
1 vote

Semi-Reliable Communications Using UDP

I would throw the code away and start over. I'd get exchanges working with small minimal test routines before evolving to classes/objects/libraries/etc. You don't need anything fancy, like queues and ...
joe snyder's user avatar
1 vote

JPG image resizing

I have no particular expertise with this, but here are some random thoughts: First, you could try resizing the the images in some other application just to get some benchmarks so you can get an idea ...
Dangph's user avatar
  • 1,683
1 vote

Precise timings with low jitter via RDTSC (for x86 and x64)

Thank you for the tutorial on timing jitter, and for the valuable references. Do I have any critiques? No, it is clear to me that you are more knowledgeable and experienced than I am in this ...
J_H's user avatar
  • 25.1k
1 vote

Delphi XE 7 project template for saving / loading form settings

I know it's old but there is very simple solution for saving and retrieving component configuration. You can save current configuration of components using WriteComponentRes : ...
Mojtaba Tajik's user avatar
1 vote

Validating Card Number in Delphi

It's overkill to use string functions for just computing the digit sum. ...
Roland Illig's user avatar
  • 21.3k

Only top scored, non community-wiki answers of a minimum length are eligible