delphi-7

Delphi: Canceling a TDataSet.Post in an OnBeforePost Event

On our main data entry screen, we have an OK/Cancel dialog in the OnBeforePost event. OK lets things take their course Cancel right now does a Dataset.Cancel; Which does what it's meant to, roll back any changes and puts the dataset into browse mode. This is fine for most of the clients, but we have been asked if it can be changed t...

Implementing nsIProtocolHandler with Delphi

I'm trying to build an nsIProtocolHandler implementation in Delphi. (I've done an IInternetProtocol before with success, and want to have in FireFox what I've got in Internet Explorer.) Thanks to the d-gecko project, that somehow links the TInterfacedObject magic to the nsISupports magic, I'm able to make a DLL that provides an nsIModule...

Is there a function like PHP's vardump in Delphi?

I've given up on the Delphi 7 debugger and am pretty much relying on outputdebugstrings. Is there a standard function I can call to get the contents of an object as a string like the debugger would if I set a breakpoint? ...

Setting EXE icon in Delphi 7

I'm trying to customize the icon that shows in Windows Explorer and in Desktop shortcuts for my Delphi application. In the Delphi 7 IDE, I have loaded the desired icon in the Application tab of the Project Options dialog. It shows my desired icon as a graphic. I didn't think it was necessary, but I also set my icon as the TMainForm Ic...

Is it possible to get the size of the type that a pointer points to in Delphi 7?

I want to get the size of any "record" type in following function. But seems it doesn't work: function GetDataSize(P : Pointer) : Integer; begin Result := SizeOf(P^); // **How to write the code?** end; For example, the size of following record is 8 bytes SampleRecord = record Age1 : Integer; Age2 : Integer; end; But GetDataSize...

How list all instantiated objects?

How can I list all instantiated objects in all application, using FASTMM4 or default memory manager? ...

Delphi: TImage.Create causes Access violation

I apologize in advance for a newbie question, but why do I get "Access violation" error with the code below (on the "Create(SelectorForm);" line)? I tried using the main form as the owner, but it didn't make any difference. var SelectorForm: TSelectorForm; ArrayOfImages: Array [1..10] of TImage; implementation procedure TSelectorF...

Delphi: creating & displaying TImage on FormCreate

Being quite a newbie, I've just had my first question answered (Delphi: TImage.Create causes Access violation) to immediately bump into a new problem: procedure TSelectorForm.FormCreate(Sender: TObject); var Loop: Byte; begin for Loop := 1 to 10 do begin ArrayOfImages[Loop] := TImage.Create(SelectorForm); MainForm.MyImageL...

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...

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...

FastMM4 says "The block header has been corrupted"

Hi. I had this nasty bug that disappeared in the past but now after quite some time it returned. I have two TSam objects (derived from TPersistent) created and loaded into an TAsmJob object (derived from TObjectList). At runtime, a form creates a TStringGrid and then the AsmJob which creates those two SAM objects (and load some data fr...

ImageList_Add returns -1 on PC controlled with pcAnywhere

One of our applications fails on computers that are controlled via pcAnywhere because the ImageList_Add() WinAPI function fails to add the image/mask after some time. The function returns -1 and the number of icons in the imagelist doesn't change. On all other computers this is no problem. What is interesting is that we can add 99 bitmap...

Is the dif or patch adder for Delphi IDE, ie if someone makes patch and I want to add it to my project automatically?

Is there DIFF plugin availaple for Delphi? I need simple add diff or patch file to my project, replaceing the porject code, that was changed in the patch, but keeping also the old one incase of falling back to old file without the patch. ...

Delphi 7 compile getting slower over time?

My project has around 400 units, it takes 20-40secs to compile after a fresh reboot, then than 1-5secs for sub-sequent re-compiles, so far so good. After working for over 3-6 hours, compiling takes 1-3mins for sub-sequent re-compiles, which forces me to reboot everytime. Is there a leak somewhere in D7? Is it problem of Windows XP? It'...

Can Delphi 2006 be Installed After Delphi 2007 is Already Installed?

During rebuild after a computer crash, I re-installed Delphi 7, then Delphi 2007. We skipped installation of Delphi 2006. However, now I would like to install Delphi 2006 before Embarcadero discontinues allowing for download of the latest version of D2006. Is it possible to install Delphi 2006 on this computer without having an advers...

Best practices for creating and parsing XML documents.

I'm in doubt if I should use TXMLTransformProvider or TXMLDocument. TXMLTransformProvider looks more maintainable, and it seems to me that using it will require less coding than TXMLDocument. In the other hand TXMLDocument looks more flexible. What I need is to generate and parse a XML document with nested attributes, map it to master...

Added the {APPTYPE CONSOLE} directive and now my application runs very slowly. Moving the mouse makes it run faster.

I am trying to extend a 3rd party application so that it can be invoked via command line in addition to using the windows form GUI (mixed mode is desired). It's a fairly simple program which basically loads a file and then you click a button it starts sending UDP network packets. I need to invoke the application from another and would...

Delphi program prevents windows shutting down properly

I have a small program which simply reads a diary text file and displays it in a memo - thats it - no buttons you double click on the form to shut it down if you want it to disappear. When it has been run (even if you close it) windows XP gets as far as "Windows is shutting down" ie. after "Saving User Settings" etc and then it hangs. ...

Is Delphi's TADOConnection thread-safe?

I'm writing a Delphi 7 application which needs to access the same SQL Server database from many different threads simultaneously. Can I use a single shared TADOConnection, or must each thread create their own? ...

XML documents and & char?

Hi Girls and rest, I have a question for XML document special chars, I'm using & in on of the value of the item in XML and TXMLDoc Delphi parser is complaining about it. I search for some XML parsing options but none of them concerning special chars, any ideas? Example: <Configuration> <Configuration_item> <view_...