delphi

Delphi 7, XML handling with Unicode support.

Hi, I'm developing in Delphi 7 (personal). I used to use JvSimpleXML for XML handling, but it doesn't seem to handle WideStrings (or does it?!). My whole project uses TntWide... & SpTBXLib for interface so it does handle Unicode very well, I need now to store some settings in files ... So I'm looking for solution or (free) replacement o...

What do I need to know to upgrade a complex application from C++Builder 2007 to 2010?

My company's main application is mostly written in C++ (with some Delphi code and components). We are upgrading from RAD Studio 2007 to 2010 for the next release, starting in about a week. What do I need to know to ensure this upgrade goes smoothly? Points I have thought of so far are: Unicode. This one looks really complicated. O...

How to get the cpu usage per thread on windows (win32)

Looking for Win32 API functions, C++ or Delphi sample code that tells me the CPU usage (percent and/or total CPU time) of a thread (not the total for a process). I have the thread ID. I know that Sysinternals Process Explorer can display this information, but I need this information inside my program. ...

Are Generics in D2009 usable in large projects?

Hi, I'm pretty frustrated. I'm using Delphi 2009 and was very happy about the inclusion of generics in this version of Delphi. Everything worked great at the beginning, but now that I use generics all over the place I run into problem after problem - most of the time some internal errors, where I don't even see where exactly they are ca...

Is there a way to load a Crystal Report 9.0 file from a stream?

Hi. I am working with Delphi and Crystal Reports 9.0 ActiveX objects. I know that I can load a report from a file like this: crApplication.OpenReport(AFileName) However, I would like to store my report in memory and open it from memory instead of file. I don't want to create any temporary files on my disk. Any ideas? Thanks for you...

Error in Free TStringList Object

procedure FreeListObjects( l : TStrings); var i : integer; BEGIN FOR i := 0 TO l.Count -1 DO BEGIN l.Objects[i].Free; l.Objects[i] := NIL; END; end; PROCEDURE StringListAdd; VAR i : INTEGER; Code : LONGWORD; BEGIN l := Classes.TstringLIST.CREATE; FOR i := 0 TO 4 DO BEGIN Code := i ; l.AddObjec...

How do I call Delphi functions in a bpl from an executable?

I have a Delphi application that I have written a fairly simple wrapper .exe for. Basically, there was a dll that had a bunch of functions, one of which I would call iteratively once my wrapper did what it needed to. I am not in control of this dll file, and will never be. Well, now this DLL is a BPL, and I'm not sure how to call func...

stop the kernell32 event

hi how can i stop or freeze the kernel32 event? for example stop the copy file?? ...

Array of (pointers to a record)

Hi. I want to create a bunch of records (RWell) and to store them in an array in a certain order. Then I want to create a new array (different layout) and rearange the records in it. Of course, I don't want to duplicate data in RAM so I though that in the second array I should put pointers to the records in the first array. However, I ca...

Delphi call method based on RTTI information

Hey all, first sorry for my bad english. Consider the following (not actual code): IMyInterface = Interface(IInterfce) procedure Go(); end; MyClass = class(IMyInterface) procedure Go(); end; MyOtherClass = class published property name: string; property data: MyClass; end; I'm setting "MyOtherClass" properties using RTTI. Fo...

Delphi VCL for Win32 - multiple event handlers.

Hi, I'm looking for some code allowing easy asigning many event handlers to a single event of object... I needed it very much for my plugin architecture, so I implemented some replacement for that, however I don't like my solution for that, so I'd like to know what is yours idea/solution/tip ... My solution is just a list with items like...

SynEdit & RegEx search

Hi, I'm looking for some example how to do regex search on SynEdit control in Delphi ? I'd like to implement something like "grep" search in the current document ... ...

Trunc() function

Hi guys, look the follow code, why the result of Trunc function is different? procedure TForm1.Button1Click(Sender: TObject); var D: Double; E: Extended; I: Int64; begin D := Frac(101 / 100) * 100; E := Frac(101 / 100) * 100; I := Trunc(D); ShowMessage('Trunc(Double): ' + IntToStr(I)); // Trunc(Double): 1 I := Trunc(E)...

How does a TCustomControl receive input focus?

I am writing a grid control which I based on TCustomControl so I can handle all the structure, painting and navigation myself. The bit that I can't seem to figure out is this: In my constructor, I set ControlStyle to this: ControlStyle := ControlStyle + [csCaptureMouse, csClickEvents, csDoubleClicks, csNeedsBorderPaint, csPannable]...

Delphi PChar to C++ const char*

I am trying to use a C++ dll from a native program. I am following the virtual method scenario as explained here Lets say my C++ function signature is of the form int Setup(const char* szIp, const char* szPort); And the corresponding delphi signature is function Setup(ip, port: PChar):Integer: virtual; cdecl; abstract; And somewh...

Pass a Delphi set to an external Delphi function from C#

I'm trying to call an external Delphi function from C# which takes a Delphi set as a parameter: Delphi code type tStatus = (sIn, sOut, sAbsent, sSick); tStatusSet = set of tStatus; function LoadEmployees(tStatusSet aStatusSet): tEmpList; I need to marshall a C# array of enum values (that is elements from tStatus) into a format t...

Dynamic Delphi form creation - ensuring correct mouse message handling

I have an Application layout that is based on a treeView at the left, and a panel on the right. The panel hosts a differnt TForm class depending on the tree node selected (a kind of 'form explorer'). There is only one form displayed at a time which exposes underlying data stored elsewhere and the form instance is created and destroyed on...

How do the new string types work in Delphi 2009/2010?

I have to convert a large legacy application to Delphi 2009 which uses strings, AnsiStrings, WideStrings and UTF8 data all over the place and I have a hard time to understand how the new string types work and how they should be used. The application fully supported Unicode using TntUnicodeControls and there are 3rd party DLLs which requ...

Static polymorphism in Delphi

Is there a way to implement static polymorphism in Delphi 2010? ...

Executing queries using DAO

I want to execute a list of queries against an Access database using DAO. The "Database.Execute()" method seems suited for this with the remark that it can only execute "action queries", that is queries which don't return a result set (MSDN reference). For queries which return records "Database.OpenRecordset()" can be used. Both methods ...