delphi

How to pass a string variable as a TSysCharSet

Is it possible to pass a string as a TSysCharSet variable? This does not compile of course: var AValidChars: SysUtils.TSysCharSet; AResult: string; begin // Edit1.Text can contain 0..9 or a..z AValidChars := SysUtils.TSysCharSet( [Edit1.Text] ); end; Thanks, Bill ...

How can I monitor / limit network traffic used by my app?

I would like to be able to measure network traffic and limit it. I'm looking for something that lets me know between two calls how much data has been sent and received. Also, I would like to be able to limit network traffic (in & out) for my app. Something like the NetLimiter software (great app!) but which I can control from my code. ...

Linear Array with nodes randomly linked to other nodes in array, shortest path.

INFO: I have an Array of 100 nodes, [ 0 .. 99 ]. Each node can have an arbitrary number of linked nodes: eg1, 0 links to 5, 10, 15, 20. eg2, 1 links to 30, 40, 50. eg3, etc.. All 100 nodes have at least one linked node, nodes do not know who links to them. QUESTION: How can I find the shortest link-path if provided with START and END...

Achieving Thread-Safety

Question How can I make sure my application is thread-safe? Are their any common practices, testing methods, things to avoid, things to look for? Background I'm currently developing a server application that performs a number of background tasks in different threads and communicates with clients using Indy (using another bunch of automa...

SetRoundMode(rmUp) and rounding "round" values like 10, results in 10,0001 how come?

This code: SetRoundMode(rmUp); Memo1.Lines.Add(CurrToStr(SimpleRoundTo(10))); Results in 10,0001. I simply don't get it. I thought that rmUp would do something like, round 10,0001 to 11, but never 10 to 10,0001. Can anyone explain why this happens? Thanks. ...

Debugging Delphi Application on Non Development Environment

I am attempting to use WinDBG or another debugger to debug a CodeGear Delphi 2007 Windows application on a remote machine. I have been unable to produce symbol files for WinDBG. Is there a way to use WinDBG or another debugger to debug Delphi applications on a system that doesn't include the IDE? Edit1 The remote debugger is not an o...

How to prevent a Delphi MDI application from showing the caption of the maximized child

Hi, how can I prevent a Delphi MDI application from showing the caption of the currently maximized MDI child in the caption of the MDI parent form? Thank you in advance! ...

How can I do a form with an image spinning in Delphi?

Like those we see in website. And where do I get the images? ...

How to make a window to stay under all the other windows ('bottom-most')

Exact Duplicate: How to make 'always on bottom' window? Related: Window on desktop? I'm developing a small application in Delphi that need to behave like a shell (replacement) launching pad (for Windows Embedded). I have some icons/buttons on it that will launch other applications. The point is that applications need to stay all the t...

Is it possible to create a use TClientDataSet in non visual unit or Inside an Class Object?

Is it possible to create and use a TClientDataSet inside an Object at runtime? I like to make several changes in my Table and have those all Applied at the same time in cache like way, and TClientDataSet lets me do that. Know when I want to do this I have to build a TForm. Is it Possible? UPDATE Can it be used, and How, without TData...

Recommendable way of rounding up currency values

First of all see the following problem: SetRoundMode(rmUp) and rounding “round” values like 10, results in 10,0001. I need to round currency values up, so 0.8205 becomes 0.83, but the SimpleRoundTo behavior displayed above is giving me some headaches. How can I round currency values up in a safe way? ...

GetMem x ReallocMem

What is the difference between System.GetMem and System.ReallocMem? Delphi 2009 Help for ReallocMem, is exactly the same description of GetMem. How about System.FreeMem and System.Dispose What should I use with arrays? type PMemberDataList = ^TMemberDataList; TMemberDataList = array[0..MaxClassMembers -1] of PMemberData; var F...

TMonitor synchronization / Application.ProcessMessages

Hello again! I'm back with another question concerning threads and synchronization. Imagine a server application that has to perform a lengthy operation and the client wants his GUI to remain responsive while he waits for the server's response. I thought of the following pattern: TMonitor.Enter (FTCPClient); try WorkerThread := TWorke...

Converting an array of bytes to an array of floats

I'm currently converting a Delphi method used for random binary file access into Java. The Delphi procedure uses: TSingleArray = Array[0..MAXSIZE] of Single ... procedure GetLinkValues(const LinkVar: Integer; const TimePeriod: Integer; var Value: PSingleArray); ... BlockRead(Fout, Value^, Nlinks*SizeOf(Single)); To read an array of...

Which Delphi component contains the most events?

I was writing some code a few days ago based on Hallvard's Hack #10, and it made me wonder, how many events tend to get put on things? So far, the highest count I've found comes from an in-house custom descendant of a DevExpress grid at the company I work for, which has 83 published events in the Object Inspector. Anyone know a compone...

Best algorithm for evaluating a mathematical expression?

What's the best algorithm for evaluating a mathematical expression? I'd like to be able to optimize this a little in the sense that I may have one formula with various variables, which I may need to evaluate hundreds of times using different variables. So basically if I can initially parse the formula so that it is optimized in some way,...

How to make scrollbars wider/bigger (including the scrollbar's arrows)

For accessibility purposes, I need to make the scrollbars for all scrollable controls (lists, list views) wider and the scrollbar arrows bigger. How to get the scrollbars (handles) from a scrollable control (ex: TListView) ? How to make the scrollbar and the arrows wider/bigger ? 10x for any hints and code... ...

Delphi 2009 OnKeyDown does not trap as Delphi 2007 does

Hello, I have this code procedure TForm1.Edit1KeyDown(Sender: TObject; var Key: Word; Shift: TShiftState); var begin if not (Key in [Ord('0')..Ord('9')]) then Key := 0; end; and it worked fine with Delphi 2007. When I upgraded to Delphi 2009 and I try to press any letter it is accepted and the Key := 0 does not trap the input? ...

What is the fastest way of stripping non alphanumeric characters from a string in Delphi7?

The characters allowed are A to Z, a to z, 0 to 9. The least amount of code or a single function would be best as the system is time critical on response to input. ...

BiDi text in Delphi - How do you select text to edit by language like this pic?

I saw this picture and now wondering if/how you can do this in Delphi. The highlighted/selected text shows two forms of formatting, i.e. highlight color and hash lines. ...