delphi

How do I handle Ctrl+C in a Delphi console application?

Are there best practices and code snippets available which show how I can handle Ctrl+C in a Delphi console application? I have found some articles which give some information about possible problems with the debugger, with exception handling, unloading of DLLs, closing of stdin, and finalization for example this CodeGear forums thread....

Transition to Unicode for an application that handles text files

My Win32 Delphi app analyzes text files produced by other applications that do not support Unicode. Thus, my apps needs to read and write ansi strings, but I would like to provide a better-localized user experience through use of Unicode in GUI. The app does some pretty heavy character-by-character analysis of string in objects descend...

Most Efficient Unicode Hash Function for Delphi 2009

I am in need of the fastest hash function possible in Delphi 2009 that will create hashed values from a Unicode string that will distribute fairly randomly into buckets. I originally started with Gabr's HashOf function from GpStringHash: function HashOf(const key: string): cardinal; asm xor edx,edx { result := 0 } and eax,eax ...

Is each source line address in a detailed MAP file a valid address to insert a Int3h?

I am trying to create a code coverage tool using Delphi 2007. My general approach is to use the Win32 Debug API to insert breakpoints for each source line and then remove the breakpoints as I pass them - thus I would be able to track each executed source line. Outline of my approach: parse the detailed MAP file (as generated by Delph...

Translating Vista WinAPI C++ header for Delphi - any suggestions?

Hi, I'm needing to call a Windows API function introduced in Vista from my Delphi app, but I don't have any Delphi headers which describe the function. Related functions are already documented in the JEDI Windows API library, but not this function. My C++ is almost non-existent, and I'm struggling to work out the Delphi definitions th...

Delphi Form Drag Lockup

Make a Delphi 2007 application, TForm as main window. Run application. Try to drag the form using the caption bar. The debugger shows an unending stream of error messages, complaining it can't find some unnamed routine. Escape and Break don't work. 3 finger salute doesn't work. Clicking in some other window and then back to the Delph...

Creating components at runtime - Delphi

Hi, how can I create a component at runtime and then work with it (changing properties, etc.)? ...

Compiling with Delphi 2009 from a command line under Windows Vista 64-bit

Has anyone succeeded to compile a Win32 GUI app with the command line dcc32.exe compiler, under 64-bit Windows Vista, without installing Delphi 2009? On our system it fails, with a message that the DFM files contain unknown 16-bit resources. This is usually an indication that the DFM files cannot be read. It works perfectly on all 32-bit...

Delphi & Vista Dragging Forms Glitch

I wondered if you have a work around for the problems with docking forms in Vista, such as the close button being partially obscured, and the gray border when being dragged rendering extremely slow, making a appearing / disappearing appearance? Delphi 2007 & Vista (64 bit) ...

Delphi - Save DateTime Null to DB (ADO / MySQL)

Hi, i have a delphi form with some DB Controls on it. To represent a date I use the TJvDBDatePickerEdit (from JCL), which has a nice property ShowCheckBox := True; to allow the user to enter that no date is known (DBNull). I verify, that nulling the DatePicker works as expected by: procedure Tframe.adoQueryBeforePost(DataSet: TDat...

Any way to find out which TField is raising EDBClient with message 'Field value required.'?

I have one TClientDataSet with several Fields and I'm getting this exception, I'm sure that I forgot to set one field value, but the question is, which Field? Is there some way to find out quickly which field is raising this exception? EDIT I solved the problem, I was connecting the TClientDataSet to the wrong provider, which had a re...

Set environment variables from Delphi (Win32)

I'm trying to set a system wide environment variable from within my delphi application. The Documentation says to add a registry key to HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Session Manager\Environment and then broadcast a WM_SETTINGCHANGE message. Anyone know how to Broadcast this message? PS. I'm trying to do this in a c...

Separating Interface and Implementation classes in delphi?

Am separating my delphi code into interface and implementation units ie. EmployeeIntf.pas looks like this type // forward declaration TScheduleList = class; TDeparment = class; TEmployee = class(BDObject) .... function GetSchedules: TScheduleList; function GetDepartment: TDepartment; end; TEmployeeList = class(DBList...

Chained invocation in Java 7?

I was just reading a Java7 preview presentation (pdf) and there was a slide on Chained Invocation. Here is the example used in the slide: // Construction with setters DrinkBuilder margarita = new DrinkBuilder(); margarita.add(“tequila”); margarita.add(“orange liqueur”); margarita.add(“lime juice”); margarita.withRocks(); margarita.withS...

Use DLL compiled in Delphi 7 in C#

Hi. I need to use a DLL (Hardware ID Extractor) made in Delphi 7 in my C# application. The functions exported by this DLL are: Exported functions: // CPU function GetCPUSpeed: Double; function CPUFamily: ShortString; { Get cpu identifier from the windows registry } function GetCpuTheoreticSpeed: Integer; { Get cpu speed (in MHz) } fun...

How to insert records in master/detail relationship

I have two tables: OutputPackages (master) |PackageID| OutputItems (detail) |ItemID|PackageID| OutputItems has an index called 'idxPackage' set on the PackageID column. ItemID is set to auto increment. Here's the code I'm using to insert masters/details into these tables: //fill packages table for i := 1 to 10 do begin Packag...

Problem with Delphi 2009 and old-style object type

Hi, I've got a lot of older code that uses the old-style pascal object type that I'm trying to get working in Delphi 2009. It compiles, but there seems to be several problems dealing with virtual methods. It appears that this problem has already been reports on Quality Central: http://qc.embarcadero.com/wc/qcmain.aspx?d=71723 I was h...

Vista: Can an EXE bypass user confirmation while invoking another EXE?

I have 2 applications written in Delphi. The first exe (with a user interface) calls another using ShellExecuteEx(), which runs as a background process. When the first exe invokes the second, one of these two things happen: When I log in as an admin, a UAC dialog comes up with the Allow/Cancel prompts. Selecting Allow continues the e...

Using Delphi to creating Win7 Jump list

I'm trying to create Jump list on windows 7 for my application using Delphi. I found this c++ code, but I'm not sure how to translate it to Delphi, any help? void CreateJumpList() { ICustomDestinationList *pcdl; HRESULT hr = CoCreateInstance (CLSID_DestinationList, ...

How do I tell if a form is in help mode?

There's a certain control which I don't have the source to (Steema TTree) it doesn't send a help message when help is requested through the form. (clicking the ? near the X on the dialog, then clicking the TTree) I can just call help directly on the form and pass in my own helpmessage, but I don't know whether the form is in help mode....