delphi

How can I identify and get rid of unused units in the "uses clause" in Delphi 7 ?

This should reduce the executable size quite a bit in some of my very large projects. I am sure there would be other benefits too. EDIT: Is there perhaps a utility that will scan the project and remove redundant ones automatically? I do have 100s of projects and "automatic remove" would be first prize although if I have to I will go the...

How to call API with PUCHAR?

Hi, I'm trying to use an API under Delphi. Here's the API documentation OKERR ENTRY SCardCLMifareStdAuthent (IN SCARDHANDLE ulHandleCard,IN ULONG ulMifareBlockNr, IN UCHAR ucMifareAuthMode,IN UCHAR ucMifareAccessType,IN UCHAR ucMifareKeyNr, IN PUCHAR pucMifareKey,IN ULONG ulMifareKeyLen); Whereas pucMifareKey: A pointer t...

Can I use xsd:complexContent with the Delphi XML Binding Wizard?

The Delphi 2009 XML Data Binding Wizard fails to process a simple XSD which contains a complexContent declaration (Invalid Pointer Operation). Is it a bug or a know limitation? Example: <?xml version="1.0" encoding="utf-8"?> <xsd:schema targetNamespace="http://example.org/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" elementF...

Why does StrToInt('X5') returns 5 in Delphi?

Why does StrToInt('X5') returns 5 in Delphi? Is X some scientific notation or something like it? Are there some other chars which will be converted to Integer as well? ...

Useful Delphi code templates

I've been programming in Delphi for a little over two years now, and I've only got maybe 5 custom templates, I feel as though I should have more. If anyone has any particularly useful ones it would be great to have a nice repository of them here on stackoverflow. I don't care whether you use the Delphi 2009 syntax or Delphi 7, but if t...

A unit calling wsock32.dll to be adapted for D2009

Here a unit i can't get working properly on Delphi 2009. I give you the original code that correctly transmit data when compiled with Delphi 2007. Ansifying the code for Delphi 2009 gives me a connection to the server but no data is transmitted and no feedback). Thanks. unit SMTP_Connections2007; // ************************************...

Delphi text offsets in edits and memos

I have noticed that in Delphi 2009, the text in a multi-line memo has different padding on the left from that in a single-line edit, though both are based on TCustomEdit. The exact offset depends on the font size: I am looking for a simple way to get the memo text aligned with the same offset as edit text. If that is not possible, ho...

How can I keep my DB connection from failing when the network is unstable?

We have a application that uses BDE connected to an Oracle DB. I use TQuery for the SQL queries, and it connects to TDatabase, we are not professional programmers, and we don't know what happens under the hood. Our network is unstable, we have an issue with packet loss. When the problem occurs, our application disconnects from the DB s...

Named/optional parameters in Delphi?

In one of the Delphi demo applications, I've stumbled upon some syntax that I didn't know the Delphi compiler accepted: // ......\Demos\DelphiWin32\VCLWin32\ActiveX\OleAuto\SrvComp\Word\ // Main.pas, line 109 Docs.Add(NewTemplate := True); // note the assignment I can't seem to reproduce this type of parameter passing in my own c...

possible type of database that uses dat, idx files

i have an application that was written in delphi it is fairly recent, running on win32 i want to hook into the database with odbc but i am unsure which database driver to use the directory with the database has .dat .idx files for each table it is a standalone database not client server (as far as i can tell) any ideas what type of dat...

"Duplicate" units in Delphi by name, referenced by components, problem with compile

We are using several component packages by different vendors, and two of them both have a "regexp.pas" unit available inside their directory structure. Problem now is that regardless of the order we compile them in, one of them complains about the unit being compiled with the wrong version of various other units. Is there any way to ha...

Check at TDataSet row against a filter string

I am using a DevExpress TdxMemData in memory TDataSet descendant. While it has Filtered: Boolean and Filter: String properties, it doesn't appear to actually do anything with them automatically, instead relying on the result of the OnFilterRecord event's Accept parameter. So what I am looking for is a way (maybe it is in TdxMemData o...

Delphi Soap Server and CF.NET application

I have a soap server written in Delphi and I am writing a PDA clinet using CF.NET 3.5 but I am getting following error "client found response content type of 'text/html', but expected 'text/xml'". If I try and consume this same webservice in a WinForm app it works fine. Sandeep ...

What would be the best solution for my Delphi apps on Linux - Delphi+Wine or Lazarus?

I need to make my Delphi solutions available on Linux and I have tested them on both Wine and Lazarus. What are the technical considerations I should take into account (Programming, Deployment, Maintenance etc.) on the longer term in order to avoid landing in a maintenance nightmare. I keep my Windows components used pretty standard to a...

Compress TComponents while writing them in a TStream

Hello, Some application we're using depends on TComponent descendants to easily save/load the state of its internal objects, with the help of Write/ReadComponentResFile function TSomeClass.SaveState: boolean; begin ... try ... WriteComponentResFile(self.f_path, TComponent(self)); result := true; except result :...

How to create Telnet Client with Delphi 5

How do I create a Telnet Client inside of a Delphi 5 application? ...

Is there a simple text diff unit for Delphi?

For data validation, for example during migrations from one XML library to a new one, we need to make sure that the old and the new text are the same. For small files, comparing can be done manually, but for large files it would save time to see only the lines which are different, missing or new. Do you know a simple but reliable diff...

Why is the executable produced by Delphi 2009 IDE different to that produced on the command line?

I'm producing builds using MSBuild, and build configurations set up in the dproj on the command line. It's slightly disconcerting that the size of the executables thus produced are different (not by much, but still!) to what an IDE build produces. Any ideas why? I would have thought the same compiler is used? ...

In Delphi 2009 do I need to free variant arrays?

If I have a variant array which holds nothing but simple types, and possible further variant arrays of simple types, do I need to do anything explicit to free memory, or is it all taken care of for me. I've always thought there is nothing to do, but I just had a slight doubt! ...

Where to put documenting comments?

Very short question: when documenting delphi code (for the purpose of enabling an external tool to generate an HTML documentation (Doc-o-matic in the concrete example)), do you put the documenting comments in the interface or in the implementation section? What I like about the second approach is that the interface part a class stays cl...