delphi-2009

Delphi 2009 Ribbon Controls - Glass Frame

I've been starting to use the new inbuilt Ribbon controls in Delphi 2009 and use the custom frame so the Application button and Mini-toolbar slide up onto the Window Frame, but I'm wondering if on Vista it should use the glass effect like Office 2007 does, and if so how I would enable this setting. Thanks for any help. ...

Delphi TThread.CurrentThread and EAccessViolation - Is This a Bug or My Incompetence..?

In Delphi 2009 I'm finding that any time I use TThread.CurrentThread in an application, I'll get an error message like the following when the application closes: Exception EAccessViolation in module ntdll.dll at 0003DBBA. Access violation at address 7799DBBA in module 'ntdll.dll'. Write of address 00000014. Unless it's just my machin...

Is there a way to see if a character is using 1 or 2 bytes in Delphi 2009?

Hi, Delphi 2009 has changed its string type to use 2 bytes to represent a character, which allows support for unicode char sets. Now when you get sizeof(string) you get length(String) * sizeof(char) . Sizeof(char) currently being 2. What I am interested in is whether anyone knows of a way which on a character by character basis it ...

What's wrong with this Delphi function?

Delphi 2009 complains with an E2283 error: [DCC Error] outputcode.pas(466): E2283 Too many local constants. Use shorter procedures Delphi 2007 compiles just fine. I can't find an abundance of local constants, it's a short (500 line) unit. Do you see any abundance of constants or literals I can address? procedure TOutputCodeForm.FormCre...

how can i make a "Surround" type Delphi Template?

i'm migrating my app to delphi 2009. my app must still use a lot of AnsiString. during migration, i find myself always converting: abc := def; into: abc := string(def); or abc := TDeviceAnsiString(def); i know i should be able to do this with templates but i find templates--although powerful--are not so easy to get working. h...

Fastest possible XML handling in Delphi for very large documents

I need recommendations on what to use in Delphi (I use Delphi 2009) to handle very large XML files (e.g. 100 MB) as fast as possible. I need to input the XML, access and update the data in it from my program, and then export the modified XML again. Hopefully the input and output could be done within a few seconds on a fast Windows mac...

Unicode Console Application in Delphi 2009

How can I create unicode console application with Delphi 2009? If I do like this: {$APPTYPE CONSOLE} uses SysUtils; begin writeln('öüğşç سيمانتت'); end. I get the following: ougsc ??????? ...

Unit SysUtils was compiled with a different version of SysConst.SMonitorLockException when trying to compile project in Delphi 2009

I'm trying to compile a project and I'm getting this error. The error occurs in a RemObjects source file, but I think it doesn't have anything to do with RemObjects. Anyway this error is too generic, and I don't quite get why it happens, so how can I solve it? ...

DoubleBuffered property beeing added in the dfm in Delphi 2009 does not exist in Delphi 2007

Does that mean that I can't share a Form between delphi 2007 and 2009? ...

How to track down tricky memory leak with fastMM?

After upgrading a project from Delphi 2007 to Delphi 2009 I'm getting an Unknown memory leak, so far I've been tryin to track it down using fastMM, here is what fastMM stack trace reports: A memory block has been leaked. The size is: 20 This block was allocated by thread 0x111C, and the stack trace (return addresses) at the time was...

Menu Accelerator Keys Not Showing Up (Delphi 2009)

I've tried my best and cannot figure out what happened here. It worked fine in Delphi 4. After upgrading to Delphi 2009, I don't know if this is the way it is supposed to work, or if it's a problem: This is what my program's menu looks like in Design Mode under Delphi 2009: Notice that every word in the Main Menu and the File submenu...

Converting projects that use Png images to D2009

Anyone that used the (not anymore) freely available TPngImage by by Gustavo Daud tried porting their projects to Delphi 2009? In my case, it seems that all TImage png images that displayed just fine in D2007 are now blank when opening the form in D2009 (if I re-add the image in D2009, save the form and open it in D2007 then the image is...

Convert string to PAnsiChar in Delphi 2009

I'm converting my applications to Delphi 2009 and faced an intriguing issue with some calls that need to convert a string (wide) to AnsiString. Here's an example to demonstrate the issue I'm having: var s: PAnsiChar; ... s := PAnsiChar(Application.ExeName); With Delphi 2007 and previous versions, s := PChar(Application.ExeName) w...

wintypes.dcu not found and code completion stops working

I'm getting the error: wintypes.dcu not found several times a day in the Delphi 2009 IDE, after this error code completion stops working, also I can't open any unit's source code with Ctrl + Click, then I have to reopen the IDE to fix it. Anyone has a clue about what can be causing this? The only IDE extension I have installed is GExpe...

Hooking a Stacktrace in Delphi 2009

The Exception class in Delphi 2009 received a number of new features. A number of them are related to getting a stacktrace: property StackTrace: string *read* GetStackTrace; property StackInfo: Pointer read FStackInfo; class var GetExceptionStackInfoProc: function (P: PExceptionRecord): Pointer; class var GetStackInfoStringProc: funct...

Generics problem

Why EAccessViolation is raised? uses Generics.Collections; ... var list: TList<TNotifyEvent>; ... begin list := TList<TNotifyEvent>.Create(); try list.Add(myNotifyEvent); list.Remove(myNotifyEvent); // EAccessViolation at address... finally FreeAndNil(list); end; end; procedure myNotifyEvent(Sender: TObj...

How can I get the X,Y position of a TWinControl (relative to the screen)

I'm trying to show a custom hint in a TWinControl but I can't figure out how to get it's position. Using position 0,0 shows the hint on the top of my screen (outside the window) so I guess it must be the position of the control on the screen. Edit: I've found the TControl Property ClientOrigin which returns what I've expected, is it c...

What are major incentives to upgrade to D2009 (Unicode excluded)?

I'm a hesitant upgrader when it comes to development tools. For roughly half of my product I still use D7, and for others D2006. The truth is, although Unicode support is more than welcomed and very useful, it could cause me more troubles than gains with my current projects (they are more-or-less Unicode ready already). It's especially ...

TDbComboBox doesn't change the first time it's changed.

I'm using D2009, and I have a TDbComboBox on my form, and if I click on it, then click an option from the menu, the first time I do so it doesn't change. The OnChange event handler fires, but ItemIndex remains at 0 (where it started at) instead of being updated to reflect the new item. After this first time, it works fine. Any idea wh...

Why the Excess Memory for Strings in Delphi?

I'm reading in a large text file with 1.4 million lines that is 24 MB in size (average 17 characters a line). I'm using Delphi 2009 and the file is ANSI but gets converted to Unicode upon reading, so fairly you can say the text once converted is 48 MB in size. ( Edit: I found a much simpler example ... ) I'm loading this text into a s...