delphi

TArray<Byte> VS TBytes VS PByteArray

Those 3 types are very similar... TArray is the generic version of TBytes. Both can be casted to PByteArray and used as buffer for calls to Windows API. (with the same restrictions as string to Pchar). What I would like to know: Is this behavior "by design" or "By Implementation". Or more specifically, could it break in future release?...

accessing a static property via COM

is it possible to access a static property of a COM object without creating an instance of the object? my situation is this: i have an unmanaged application (written in delphi). this application exposes a COM-based plugininterface. until now i only wrote managed plugins in c#. plugins provide their info (name, author, ..) via a static p...

Synapse and string problems with HTTPSend in Delphi 2010

I have been trying to get to the bottom of this problem off and on for the past 2 days and I'm really stuck. Hopefully some smart folks can help me out. The issue is that I have a function that I call in a thread that downloads a file (using Synapse libraries) from a website that is passed to it. However, I've found that every once in a...

delphi tidhttp get procedure not working on some urls

Hi guys, I am encountering a problem in delphi Tidhttp component wherein the GET procedure can't fetch a specific url but on other urls it is working. Example: this code returns an empty response.datastring. Response.datastring is empty only with this error_url but with other urls the response.datastring has a value. I need to fetch th...

Delphi - ListView Question

Is there a ListView (ListBox) or similar component that allows me to easily drop another component in a specific column. (Multiple columns)? Like a checkbox, button or drop down list or all the above. (It would be nice to be able to sort via the header also) If not does anyone know of a resource on how to custom draw something like thi...

GDI+ & Delphi, PNG resource, DrawImage, ColorConversion -> Out of Memory

I have started to toy around with GDI+ in Delphi 2009. Among the things that I wanted to do was to load a PNG resource and apply a Color Conversion to it when drawing it to the Graphics object. I am using the code provided in http://www.bilsen.com/gdiplus/. To do that I just added a new constructor to TGPBitmap that uses the same code fo...

Difference between GetPixel and Canvas.Pixels in Delphi

Hey, Is the Api Function "GetPixel" faster than Canvas.Pixels ? ...

Easiest way to find previous instance of an application

I have rewritten a VB6 application in Delphi. It should have only one instance running. How can I do this with minimum of code? In VB6 we just have to use one single line of code > If App.PrevInstance Then 'Take some action End If On goggling I did find a solution but it is very length and we have to mess with .drp file....

How do I deploy applications in run as administrator mode?

Hello, How Do I deploy applications so that they require administrator rights without the end-user doing that by hand? I use Delphi 2009 to build the application. ...

How can a component at designtime determine the project directory

Hello, I write a component which should store some information relative to the project directory. Every time a property of my component is changed it should write a file. So how can a component determine the current project directory at design time. Thanks in advance EDIT: I want to generate a delphi source file every time a property...

Is there any better IDOMImplementation other than MSXML?

There are 3 IDOMImplementation available in Delphi: MSXML Xerces XML ADOM XML v4 MSXML is the default IDOMImplementation. My test is count the time need to load a 10MB xml file. I use a Delphi unit generated from a XSD using XML data binding to load the xml file. This unit has 3 common function: function Getmenubar(Doc: IXMLDocum...

Resize PNG image

HI! Could you please tell me how to resize a .png image. Or better give an example. I've been searching for the answer for a long time and it seems that nobody knows how to resize a .png image and keep its transparency. :( ...

Searching for known Team Development helper tools

Hello, My team is small, only two programmers.We both share one source ,but we live in different places.The problem is that Meanwhile I make changes on our project,the other team worker makes changes as well.It's very hard to write down every change,at least for us. When we decide we've made an important change,we contact each other sen...

String Sharing/Reference issue with objects in Delphi

My application builds many objects in memory based on filenames (among other string based information). I was hoping to optimise memory usage by storing the path and filename separately, and then sharing the path between objects in the same path. I wasn't trying to look at using a string pool or anything, basically my objects are sorte...

How to pass multiple different records (not class due to delphi limitations) to a function?

Hi to all. I have a number of records I cannot convert to classes due to Delphi limitation (all of them uses class operators to implement comparisons). But I have to pass to store them in a class not knowing which record type I'm using. Something like this: type R1 = record begin x :Mytype; class operator Equal(a,b:R1) end; type ...

Finding folders

Hello. I want to find how much folders are in folder or I should say how much SubFolreds are in folder. So, how I should do that??? P.S. I'm programing with Delphi ...

How to send a mail message using Indy's smtp server component?

Since the demo given in http://www.indyproject.org/Sockets/Demos/index.EN.aspx only saves the received stream to a file, I don't know how to effectevely send that stream as a mail. Could anyone teach me how to do this or to point me some more complete example? ...

Strange rare out-of-order data received using Indy

We're having a bizarre problem with Indy10 where two large strings (a few hundred characters each) that we send out one after the other using TCP are appearing at the other end intertwined oddly. This happens extremely infrequently. Each string is a complete XML message terminated with a LF and in general the READ process reads an enti...

How can I dynamically inject code into event handlers in Delphi?

For debugging / performance tests I would like to dynamically add logging code to all event handlers of components of a given type at run time. For example, for all Datasets in a Datamodule, I need to run code in the BeforeOpen and AfterOpen events to capture the start time, and to log the elapsed time in AfterOpen. I would prefer to d...

How can a Delphi TForm / TPersistent object calculate its own construction and deserialization time?

For performance tests I need a way to measure the time needed for a form to load its definition from the DFM. All existing forms inherit a custom form class. To capture the current time, this base class needs overriden methods as "extension points": start of the deserialization process after the deserialization (can be implemented by ...