delphi-2009

TObjectList<T>.Contains causes Access Violation in Delphi 2009

时光总嘲笑我的痴心妄想 提交于 2019-12-08 02:28:00
问题 In Delphi 2009, I had no major problems with Generics so far (using Generics.Collections lists, with no special Generics features). Now I found this code will cause an AV in the line which accesses MyList.Contains . The error disappears if I declare TMyList = class(TList<TMyEntry>) ; Should I avoid TObjectList<T> or is something else in my code causing this error? type TMyEntry = class(TStringlist); TMyList = class(TObjectList<TMyEntry>); procedure TListTests.TestAV; var Entry: TMyEntry;

Delphi Pascal - Using SetFilePointerEx and GetFileSizeEx, Getting Physical Media exact size when reading as a file

一个人想着一个人 提交于 2019-12-07 23:38:46
问题 I do not know how to use any API that is not in the RTL. I have been using SetFilePointer and GetFileSize to read a Physical Disk into a buffer and dump it to a file, something like this in a loop does the job for flash memory cards under 2GB: SetFilePointer(PD,0,nil,FILE_BEGIN); SetLength(Buffer,512); ReadFile(PD,Buffer[0],512,BytesReturned,nil); However GetFileSize has a limit at 2GB and so does SetFilePointer. I have absolutley no idea how to delcare an external API, I have looked at the

Object orientation and serialization

扶醉桌前 提交于 2019-12-07 12:22:53
问题 Consider an interface like IMyInterface = interface procedure DoSomethingRelevant; procedure Load (Stream : TStream); procedure Save (Stream : TStream); end; and several classes that implement the interface: TImplementingClass1 = class (TInterfacedObject, IMyInterface) ... end; TImplementingClass2 = class (TInterfacedObject, IMyInterface) ... end; ... I have a class that has a list of IMyInterface implementors: TMainClass = class strict private FItems : TList <IMyInterface>; public procedure

How to handle UTF-8 and ANSI conversion before Delphi 2009?

不羁的心 提交于 2019-12-07 12:18:15
问题 In Delphi 2009 we have: RichEdit1.Lines.LoadFromFile(OpenDialog1.FileName,TEncoding.UTF8); RichEdit1.Lines.SaveToFile(OpenDialog2.FileName,TEncoding.Unicode); How do I do that on Delphi 2006 if I do not have TEconding yet? Is there someway to transport that newer library back there? or is there a solution hidden in the Web? 回答1: I believe that UTF8Encode and UTF8Decode were present even before Delphi 2009. So you can decode/encode byte strings manually. (I have done that myself.) 回答2: Here is

Delphi 2009 Function eliminated by linker

隐身守侯 提交于 2019-12-07 11:58:30
问题 I want to use the function DateTimeToStr while debugging a project. I want to use either the evaluate/modify window, or the watch window. This always results in the error "Function eliminated by linker". I've ensured that the function is used by the project (I also placed a call explicitly in the function I want to debug), also I turned off the optimization and recompiled the whole project. 回答1: I made the following program program WhereDidItGo; {$APPTYPE CONSOLE} uses SysUtils; begin

Is there an easy way, to Port a Win32 App in Delphi 2009 to .NET?

早过忘川 提交于 2019-12-07 11:49:42
问题 We want migrate from Delphi 7.0 to Delphi 2009, to stay up with a modern IDE and current technology. Our target platform is .NET. What is best way, to achieve this goal? 回答1: I'd take onboard the Unicode situation with string handling that came in from D2007 to D2009 - the changes involved in this step might affect your application a lot (only you can tell this). Also, you will need to consider what third party tools/libraries/components you are using. Not everything has made the jump to

A simple way to show activity on the tab for a TTabSheet

♀尐吖头ヾ 提交于 2019-12-07 09:51:28
问题 Basically I want an activity indicator that will show at a glance that there is an active calculation in progress on that tab. I'm looking for something very simple, like showing a gif on the tab, or showing a sequence of strings that change with a timer. I don't want a complicated solution or a solution that requires new components. I already have an implementation, but I'm having a problem with it that I'm asking for a more specific solution to here: How to show backslash in a japanese

How do I make TProgressBar stop lagging?

强颜欢笑 提交于 2019-12-07 08:27:19
问题 I've got an app that runs a long set of operations, and I'm trying to use a TProgressBar to keep track of what's going on. I set a number of steps, and call .StepIt to increment the progress bar. Problem is, it doesn't keep up very well. Instead of jumping directly to the correct position, it seems to like to slide gradually up to it. That's all well and good if it's eye candy you're after, but when I'm trying to get an accurate representation of my routine's progress, this makes it appear to

Delphi 2009 classes / components to read/write file permissions

淺唱寂寞╮ 提交于 2019-12-07 07:51:27
问题 Does anyone have a set of classes / components that will work with Delphi 2009 (Unicode) to read and write NTFS file permissions? There was a thing called "NTSet" - but they stopped development at Delphi 2006 about 3 years ago :-( Any other takers?? Thanks! Marc 回答1: JCL has units to deal with file permissions, and they claim D2009 compatibility. 回答2: Colin Wilson's "NT low-level" component set wraps the APIs you need, and supports Delphi 2009 as well as earlier releases. However you may need

Max length for a dynamic array in Delphi?

本秂侑毒 提交于 2019-12-07 06:11:10
问题 I was curious how long a dynamic array could be so I tried SetLength(dynArray, High(Int64)); That has a value of 9,223,372,036,854,775,807 and I figure that would be the largest number of indexes I could reference anyway. It gave me a: ERangeError with message 'Range check error'. So I tried: SetLength(dynArray, MaxInt); and got the same error! Interestingly I could call it with SetLength(dynArray, Trunc(Power(2, 32)); Which is actually twice the size of MaxInt! I tried SetLength(dynArray,