delphi

Frame inheritance and duplicate files in packages

I have been developing a number of components using TFrames and ModelMaker -- I've found the combination of visual design/development + inheritance + ModelMaker to be very compelling. I then register these TFrame descendants w/a registration unit, and they become full-fledges palette-based components from there. I'm using Delphi 2007. E...

In Delphi IDE, how to quickly determine the location of an open non-project-related file?

This is probably a question that has an easy/simple/obvious answer, but I've found myself asking it many, many times, and never able to answer it: When I Ctrl-click a class name, Delphi loads up the unit that defines it (assuming it's on the browse path). Once it's open in the IDE, is there a way to quickly find out where that PAS file...

Why would you check for Assigned(self) in object methods?

I am looking at some code (Delphi 7) with following check is at the top of every method call for a specific object: if not Assigned(self) then raise Exception.CreateRes(@sAbstractError); { Real code for this method} I guess that this would prevent me from trying to call a method on a null object pointer. But I would get an excep...

How to test labels in QTP

I'm using QTP 9.5 test my application written in Delphi. I got Delphi Add-in installed and QTP can identify Delphi controls. Most but not all, specially TLabel. QTP can not recognize this control and is being ignored by Object Spy. Any suggestion, tip, clues how to test labels ? cheers ! ...

AnsiString return values from a Delphi 2007 DLL in a Delphi 2009 application

I have a DLL compiled with D2007 that has functions that return AnsiStrings. My application is compiled in D2009. When it calls the AnsiString functions, it gets back garbage. I created a little test app/dll to experiment and discovered that if both app and dll are compiled with the same version of Delphi (either 2007 or 2009), there i...

Replacement of Delphi IDE "Sync Edit" in Visual Studio

There is a feature in Delphi IDE (Borland Developer Studio 2006) which allows to edit some variable in "sync mode". For example if you have a code snippet like this: 2qdo8sz.png You can select the text you want to modify (in this case the complete procedure) and start editing a variable name. It will be edited at all the places (except ...

Create TImageList by specifying paths only

In Delphi 2007, images are loaded in a TImageList at design time. This introduces the following problem: I have a folder containing the graphics I'm using in my application Whenever I want to change, say, the icon for 'save', I have to Change the graphic in the folder (for my own purposes) Iterate along all TImageLists in the applicat...

Delphi TCoolBar - CoolBand alignment

Is it possible to align the CoolBands to the left side of the CoolBar? Means when the CoolBar (Form) is resized and the CoolBands move to the row below, the Band should be aligned to the left side of the Bar (instead to the right). Similar the menu behaviour, when the items doesn't fit into one row anymore. Furthmore is it possible to...

Delphi Dynamic Dll - global variable

Hi, I am busy coding a dll that supplies several functions to a host application. This application calls the dll dynamically, loading and freeing it after every function call. I have no control over the host app. I can only work with within the dll. Is there a way I can keep certain variables in memory so that I can reuse them within e...

Horizontal text orientation on left aligned tabs of PageControl

Is there any possibility to orient left aligned tab captions horizontally? ...

How to use the C# Generics in delphi 2009/2010?

Hello, I have the following method in C#: public T Read<T>() { T[] t = new T[1]; int s = Marshal.SizeOf(typeof(T)); if (index + s > size) throw new Exception("Error 101 Celebrity"); GCHandle handle = GCHandle.Alloc(t, GCHandleType.Pinned); Marshal.Copy(dataRead, index, handl...

Mouseover hint for TChart series value

I am using a TChart in Delphi 7, and I want to display some bar charts. I am using the following code to set up the series values from a database query: chart1.FreeAllSeries; chart1.SeriesList.Clear; chart1.AddSeries(TBarSeries.Create(Self)); TBarSeries(chart1.Series[0]).BarStyle:=bsRectGradient; with query1 do begin ...

Memory leak using WMI in Delphi 7

I'm experiencing a memory leak when using WMI from Delphi 7 to query a (remote) pc. The memory leak only occurs on Windows 2003 (and Windows XP 64). Windows 2000 is fine, and so is Windows 2008. I'm wondering if anyone has experienced a similar problem. The fact that the leak only occurs in certain versions of Windows implies that it mi...

Delphi App Communicates with Program That Ends Up Crashing Occasionally - Vendor Blames My Delphi App

I've written a Delphi DLL that communicates with a third party program via COM. Some users report that the third party program crashes occasionally. Others using the software in an identical fashion have never experienced a crash. When this crash occurs, the third party program appears to simply become unavailable in my DLL app. The ...

IncHour procedure in DateUtils

I have the following bit of Delphi 7 code to increment a TDateTime value by one hour. For some reason it doesn't work. StatusMemo.Lines.Add('prior '+DateTimeToStr(dtval)); IncHour(dtval,1); // add an hour for DST StatusMemo.Lines.Add('after '+DateTimeToStr(dtval)); Contents of StatusMemo after code runs: prior 6/24/2009 5:35:40 A...

InstantObjects references load

Is there any way not to load references into InstantObjects? Let say I have TCountry which have references TCity. In some cases I need to load only TCountry without cities. To display in a list. Not big deal, but in some cases it can speed up my application a lot. ...

Install D5 (& third party comps) on a machine with Delphi 2007?

I've got a Delphi 2007 VM which includes a reasonably up-to-date Report Builder and Dev Express Suite. I use it for a particular project for a particular client. For that same client, I also have a D5 VM which just so happens to use a (different, older) version of Report Builder and a different (older) version of some of the Dev Express...

nsIProtocolHandler: trouble loading image for html page

I'm building an nsIProtocolHandler implementation in Delphi. (more here) And it's working already. Data the module builds gets streamed over an nsIInputStream. I've got all the nsIRequest, nsIChannel and nsIHttpChannel methods and properties working. I've started testing and I run into something strange. I have a page "a.html" with this...

Quality of Sybase ASE support in Delphi

I have Delphi Professional 2007 and 2009 and was thinking of upgrading either or both to Enterprise due to a new project that requires me to interface to a Sybase ASE database. I did some web research and it appears that 2007 Sybase driver leaked memory and it doesn't appear that this problem was fixed. Does anyone know if the Codegear...

Delphi 5 & Crystal XI Rel. 2 (RDC) how to?

Hi Guys! I'm trying to work with the class from JosephStyons but I do get an "Invalid Index" Error on the line where the "User ID" should get set. FRpt.Database.Tables[i].ConnectionProperties.Item['User ID'] := edUserName.Text; Here's my environment: WinXP Sp3, Crystal Reports Developer XI Rel.2 SP4, Delphi 5 Update Pack 1 Any help...