delphi

Conditional directive to identify C++ Builder personalities

Hello, I have a Delphi component which I want to install and have it available at the component palette in Delphi but not in C++ Builder. In BDS/RAD 2006 and above I can either have it installed for both personalities or none. I need to do so because this component uses 3rd party libraries that doesn't support C++ Builder. I have look...

Do console apps run faster than GUI apps?

I am relatively new to world of programming. I have a few performance questions: Do console apps run faster than apps with a graphical user interface? Are languages like C and Pascal faster than object oriented languages like C++ and Delphi? I know language speed depends more on compiler than on language itself, but do compilers for pr...

Storing a set of values in Delphi

I am trying to store a set of values in delphi, but i want to be able to address them using their name, instead of an assigned number. For example, an array of 'OldValues' would let me do OldValue[1] := InflationEdit.Text; Ideally however, i would like to have a value stored in 'Data.Inflation.OldValue' for example. For each identi...

Is it possible to have a global exception hook?

Hi, my code is fairly well covered with exception handling (try..except). Some exceptions are not expected to happen and some exceptions happen fairly often, which is expected and ok. Now I want to add some automated tests for this code. It would be good to know how many exceptions happened during execution, so I can later see if the ex...

Unit finalization order for application, compiled with run-time packages?

I need to execute my code after finalization of SysUtils unit. I've placed my code in separate unit and included it first in uses clause of dpr-file, like this: project Project1; uses MyUnit, // <- my separate unit SysUtils, Classes, SomeOtherUnits; procedure Test; begin // end; begin SetProc(Test); end. MyUnit look...

Repeating procedure for every item in class

Data.XX.NewValue := Data.XX.SavedValue; Data.XX.OldValue := Data.XX.SavedValue; I need to do the above a large number of times, where XX represents the value in the class. Pretending there were 3 items in the list: Tim, Bob, Steve. Is there any way to do the above for all three people without typing out the above code three times? ...

Accessing data stored in another unit Delphi

In Unit2 of my program i have the following code: TValue = Record NewValue, OldValue, SavedValue : Double; end; TData = Class(TObject) Public EconomicGrowth : TValue; Inflation : TValue; Unemployment : TValue; CurrentAccountPosition : TValue; AggregateSupply : TValue; AggregateDemand : TValue; ADGovernmentSpending ...

Print next to a text a picture or char(251) in report builder

I draw a checkmark next to the some text in a Devexpress datagrid column, now I have to print it. Any Idea ? ...

Is there any way to name external threads?

TThread.NameThreadForDebugging is great for telling threads apart, but not all of my threads are TThread descendants. I have some that are created by an external library that's not even written in Delphi. Is there any way to name them if I can find a way to get their thread handles? ...

delphi Ado update insert betwen 2 records

i need to update records from one table to the other (this for the master Table and f«the same for the DetailTable. first a position the record of the record´s of the table i want to copy update from: Tabelamestre(Local_deste_cliente) (1 record ) NInterv.text:=dbedit1.text; Begin with ADOTable_casa do Begin Close;...

Stop VCL Child Controls from Inheriting Parent Popup Menu

I have a Delphi 2007 VCL TPanel with a TPopupMenu assigned to it. There are some TEdit controls on the panel. The edits inherit the popup menu of the parent panel. I want to not allow this popup inheriting, so the edits will show the default Windows TEdit popup menu with Copy, Cut, Paste, etc., but have not found a way to do it yet. T...

Delphi: OnTimer event of my own Timer never happens

I need a Timer in a 'no form' Delphi unit (there's still a main unit with a form), so I do this: unit ... interface type TMyTimer = Class(TTimer) public procedure OnMyTimer(Sender: TObject); end; var MyTimer: TMyTimer; implementation procedure TMyTimer.OnMyTimer(Sender: TObject); begin ... end; initialization MyTime...

Delphi and TextWidth/TextHeight in PDF with unicode text

Hi. I'm new with unicode, so I hope anybody can help me. I want write unicode to a PDF, now I need the width and height of the unicode text for text formatting. For AnsiString I have this functions in PDF class: function PDFClass.TextWidth(Text: AnsiString): Single; var i: integer; ch: AnsiChar; tmpWidth: Single; chv: Integer; ...

delphi remove . and .. from path

Hello everyone. How can I remove the . and .. from a path in Delphi (not using .NET). I need a function, so I can pass it something like 'c:\program files..\program files...', and I want the function to return to me 'c:\'. Can Delphi do that on its own? Or do I need to do it myself? ...

Exchanging strings (PChar) between a Freepascal compiled DLL and a Delphi compiled EXE

After a lot of experimentations, I found a way to exchange PChar from a FreePascal compiled DLL with a Delphi compiled EXE. I'm in charge of both the DLL and EXE source code but one MUST BE in FreePascal and the other one in Delphi. My solution involves the following methods in the DLL: function GetAString(): PChar; var aString: string;...

How to align MDIChild on left?

Hi, I am trying hard to align MDIChild form to the left of the parent MDIForm setting Align:=alLeft at design time. On the Parent MDIForm is toolbar aligned to alTop. Apparently aligned MDIChild is higher than parents client area (I do not know why), that's why vertical scrollbar appears on parent form. The problem is, that I want this ...

Delphi - Capture stdout and stderr output from statically linked MSVC++ compiled DLL

I have been trying to capture stdout and stderr output from a DLL compiled in MSVC++ that my Delphi app statically links to, but so far have been unsuccessful. procedure Test; var fs: TFileStream; begin fs := TFileStream.Create('C:\temp\output.log', fmCreate or fmShareDenyWrite); SetStdHandle(STD_OUTPUT_HANDLE, fs.Handle); SetS...

ODETTE FTP (OFTP) for .NET or Delphi

I'm trying to come up with a proposal for a client for an interface with a European Automotive manufacturer. The standard interface to transfer data files(EDIFAC) is ODETTE-FTP (OFTP). I'm trying to find a native component solution, much like what's available for other FTP formats. After much Google searching I haven't been able to fin...

Delphi 6 storeproc on windows 7

I work with Delphi 6 and SQL Server 2008. With Windows Vista everything runs ok. But since i change my OS to Windows 7 all my projects started to show a message when i'm trying to compile them that says "Stored procedure (SPname). Doesn't found or doesn't exist in the server. I look my server and it has the Sp with the correct name. i u...

Calling a C function in a DLL with enum parameters from Delphi

I have a third-party (Win32) DLL, written in C, that exposes the following interface: DLL_EXPORT typedef enum { DEVICE_PCI = 1, DEVICE_USB = 2 } DeviceType; DLL_EXPORT int DeviceStatus(DeviceType kind); I wish to call it from Delphi. How do I get access to the DeviceType constants in my Delphi code? Or, if I should just use the ...