I have written an FAQ here which covers the basics of thread-protecting an object. I was wondering if someone can review this FAQ and let me know if I'm wrong anywhere or any input on what I should change?
JD Solutions
I've always like the way that RAD Studio put together its setup screens. For example, Project > Options, or Tools > Options. I'm trying to re-create such a setup system in an application of its own for a legacy Delphi server/client system. The current setup is scattered into many different...
Ah Ha! In IdHTTPWebBrokerBridge.pas...
function TIdHTTPAppRequest.GetStringVariable(Index: Integer): AnsiString;
...
case Index of
...
INDEX_URL: Result := AnsiString(''); // Root - consistent with ISAPI which return path to root
So Indy is leaving this field blank for some...
I tried tracking the reading of the URL property and wound up getting confused how this actually works internally, got stuck at:
function GetStringVariable(Index: Integer): AnsiString; virtual; abstract;
Where Index = 1
But this is an abstract function...?
JD Solutions
I'm using Delphi XE2, Indy 10, and a TIdHTTPWebBrokerBridge. In the web module, requests are handled via TWebRequest and TWebResponse objects. I need to read the full complete URI which was sent from the client, but in the TWebRequest, the only relevant property, URL, returns empty. Why is this...
This procedure snaps a screenshot of a given monitor, and optionally includes the mouse cursor.
Bitmap: Any TBitmap which you want the screenshot written to
MonitorNum: Index of monitor (0 = main)
DrawCursor: Whether or not to draw mouse cursor
Quality: Pixel Format (pf24bit recommended)...
There are many ways to thread-protect objects, but this is the most commonly used method. The reason you need to thread-protect objects in general is because if you have more than one thread which needs to interact with the same object, you need to prevent a deadlock from occuring. Deadlocks...
A small project of mine has lead me to point out how flexible this solution is. I originally needed to make a mechanism to encode/decode strings by using my own replacement values. This turned into a different solution where you can easily specify the replacement values to use. A major advantage...
There are many scenarios where you do not want certain things to happen when your components is in design-time. These are things which of course should only be performed when the actual product is being run. There's a simple solution to this, but first the background.
The Delphi TComponent is...
NOTE: I have done many modifications to this thread and I will update it as soon as I have a stable copy. I'm trying to build this thing to be universal. I now have a field for Keywords (Search String) yet it's not yet doing a very intelligent filteration of files based on the keywords.
What I...
NOTE: I have tested this component, but not too extensively. I've run multiple image filters on a large directory structure of over 6,000 different images, a number of different times, and have only found very minor flaws, such as the "OnStop" event being triggered a millisecond before the very...
I have written a new FAQ on searching for files:
http://tek-tips.com/faqs.cfm?fid=7639
NOTE: This is not to search for a file by name or keyword, but instead to search for any files recursively matching certain file types.
It's a multi-threaded component which can be installed into your...
Delphi does not come with a built-in way to make it easy to search for files. Instead, you need to make Windows API calls to FindFirst and FindNext. This method doesn't automatically take recursive searches into consideration either, you must implement this yourself.
There is always some...
It could be as simple as "feeding the thread a poison" as someone told me once in the past, but that would require unmanaged threads, I need to carefully manage the existence of each one, up until its time of destruction. The way I'm moving, I can't depend on feeding it a poison command and...
Please bear in mind that as mentioned, I have not even tried to run (or even compile) this yet, and yes there are problems such as I'm not removing the free'd thread from the list... It's the concept that I'm aiming for though.
JD Solutions
I'm building a database thread pool, the pool has a property for thread count. By default this is 0 so there's no threads until this is set. The property reads the list count directly, so I don't store anything like "FThreadCount: Integer". So, the property setter needs to be responsible for...
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.