delphi

Delphi and pointermath (possible bug in the documentation)

I was browsing the Delphi 2009 language guide. And found something strange. In the list of directives (not compiler directives) I found pointermath. RAD-Studio Reference Delphi Reference Delphi Language Guide Fundamental Syntactic Elements Fundamental Syntactic Elements [Directives] I know it...

Text to speech

I am improving a small alarm/reminder application that I build years ago, and I would like to do an hourly beep, but instead of beeping it would be much nicer it would tell time. Is there any simple way to do this in DELPHI D2007 or later? Thanks ...

Delphi 2007 not consuming JAX-WS web service properly

I'm having an issue with Delphi 2007 when trying to consume a web service I've set up in Java using JAX-WS. The web service can be consumed fine from another Java program and from a C# / ASP.NET 2.0 website. However, when I try to access the same service using the WSDL Importer in Delphi 2007 (17-DEc-2007 patch), the JAX-WS web service d...

delphi 7 SOAP application stop compiling

Hello there, I don't know why, but a SOAP Server application and a pair of clients of this services stop compiling without any know causes for me. I have installed delphi 2007 and delphi 2009 and I don't know if the cause can come from this. Now when I compile a soap application I get an error like: 'Unit XMLSchema was compiled with a ...

Switching Control Types (but not names) for Lots of Controls on a Form in Delphi

I need to switch every control of a particular type on a form to a different type while maintaining the name and the code associated with each control. For example, let's say I need to switch a dozen or more TEdit fields to TSpinEdits. How can I do that in Delphi 2007 with minimal effort? ...

Dataset Update Filter Location

This has always bugged me to what is the best way to do the following... with a simple one to many db, when you have 2 tables/grids on a form and the 2nd one filtered by the first. where is the best place to put the filter code ie: procedure TForm1.tblCustormersAfterScroll(DataSet: TDataSet); begin if tblCustormersCustormerID.AsS...

Delphi, possible to make a form modal to specfic parent form only?

I've got an application where there's a main background form, from there user can only non-modal forms that maintains different part of the system. The non-modal forms overrides the CreateParams method so each one displays a button in the start task bar: procedure TfmMaterialsPlanning.CreateParams(var Params: TCreateParams); begin in...

Exception Logger: Best Practices

I have just started using an exception logger (EurekaLog) in my (Delphi) application. Now my application sends me lots of error messages via e-mail every day. Here's what I found out so far lots of duplicate errors multiple mails from the same PC While this is highly valuable input to improve my application, I am slightly overwhelmed...

ADO, Adonis, Update Criteria

On a form, I have a Quantum Grid and some db-aware editcomponents. When appending a new record in the grid, typing some editvalues both in the grid and the separate editcompoennts, I get an error: EOleException: Row cannot be located for updating. Some values may have been chenged since it was last read After some googling, I thin...

Constructing an Object from a Class Reference

I have a method which constructs an object, calls an Execute method, and frees the object. The type of object is determined by a TClass descendant passed into the method. Note this is Delphi for Win32 I am talking about, not .NET. Edit: I should point out that this is Delphi 2006, as it has been noted in answers below that in future ver...

Filtering A TClientDataSet On A NestedDataSet Field

I have a small application I am working on that is almost finished thanks to those who have assisted me here. I have one last task however. I need to be able to Filter a TClientDataSet on a NestedDataSet field. ClientDataset1 Field0: Name (Lake Name) ClientDataset2 Field0: Species (Fish Species) type TDataModule1 = class( TDataModu...

Where can I find documentation and/or examples of working with TMetafile and TMetafileCanvas?

As I'm working to add custom printing to my application, I've settled on using TMetafile to create the pages, then using it to preview &/or print, but I'm finding the documentation lacking. Are there any good resources for learning the ins and outs of working with TMetafile and TMetafileCanvas? ...

linear transformation function

Problem: I need to write a function that takes 4 bytes as input, performs a reversible linear transformation on this, and returns it as 4 bytes. But wait, there is more: it also has to be distributive, so changing one byte on the input should affect all 4 output bytes. The issues: if I use multiplication it won't be reversible after ...

How do I hook global shortcuts in Windows?

I remember using a program, some years back, that allowed me to fine-tune my monitor's settings with custom gamma ramps and other adjustments. It had the ability to create different screen-settings profiles for different uses, and setup global hotkey shortcuts to activate them without switching out of the program you're in. My question...

Why do I need to restart Delphi 7 to get the debugger to work sometimes.

I've been meaning to ask this question for a while, at least 4 times a day I need to restart Delphi to get the debugger to stop at breakpoints again. Sometimes I can trick it into working again by attaching to the process after a rebuild of the code. But most of the time I can't and it is costing me a lot of time to go back and re-open...

What is the best way to stop an application being copied and used without the owner’s permission?

What is the best way to avoid that an application is copied and used without the owner’s knowing? Is there any way to trace the usage? Meaning periodically the application communicates back, with enough information so that we can know where it is, and if it’s legal. Next thing, of course, shut it down, if it’s not legit. ...

How do I StretchDraw two graphics beside each other on a custom TGraphicControl?

I'm writing my Delphi TGraphicControl paint procedure. I create a canvas and I stretchdraw it onto the graphic area. It works well. Then I repeat this with another Stretchdraw onto the graphic area but it is drawn in the area of the first Stretchdraw and not onto the graphic area as I direct it. Is there a way that can place both stre...

Sorting values, but only if they are X more than current order

Hi, I've been searching Google (and stack overflow of course!) for a way to sort a list of integers by value, but also by an extra factor. I'm looking for some sort of algorithm to implement I suppose. So far, I have an array in Delphi 2007 that sorts the values from largest to smallest, but now I would like it to sort values that are...

Replace function units

I am writing a unit test infrastructure for a large Delphi code base. I would like to link calls to pure functions in SysUtils.FileExists for example to a "MockSysUtils.FileExists" instead. Creating a SysUtils unit with the same interface is not appreciated by the compiler. What I am thinking of is to hook in my mock function at runtim...

How can I find the process id from the service name/handle in Delphi?

I have the service name for a windows service in delphi, and I know how to get the handle from that as well. What I need to do is stop a service, and if the stop fails for some reason I need to kill the process associated with the service. The problem is that I have multiple services running from the same executable, so I can't use the...