In recent versions of Delphi, you can use the deprecated directive to flag obsolete methods which should not be used anymore. This allows code which calls them to compile, but the compiler will emit a warning. For example, look at the following declaration from SysUtils:
procedure RaiseLastWin32Error; deprecated; // use RaiseLastOSError
If you call this method in your code, the compiler will emit a warning like this:
[Warning] Unit1.pas[28]: Symbol 'RaiseLastWin32Error' is deprecated
We can see from the comment in SysUtils that RaiseLastOSError is the intended replacement. But not all deprecated methods have such comments, so the list below is intended to help find good replacements.
Methods Deprecated in Delphi for .NET[]
- AnsiStartsText
- For the WideString overload, use System.String.StartsWith()
Methods Deprecated due to Platform Compatibility[]
- RaiseLastWin32Error
- Use RaiseLastOSError
- IncludeTrailingBackslash/ExcludeTrailingBackslash
- Use IncludeTrailingPathDelimiter/ExcludeTrailingPathDelimiter
List of Deprecated elements in Delphi 2005[]
ActnMenus Unit[]
TCustomActionMenuBar.GetDefaultSounds;
var MenuItemControlClass: TMenuItemControlClass deprecated; MenuAddRemoveItemClass: TAddRemoveItemClass deprecated; MenuButtonControlClass: TMenuButtonControlClass deprecated; MenuPopupClass: TCustomPopupClass deprecated; MenuCustomizePopupClass: TCustomizeActionToolBarClass deprecated;
ComCtrls Unit[]
- CheckToolMenuDropdown
- Use TToolButton.CheckMenuDropDown
Forms Unit[]
- MakeObjectInstance
- Use Classes.pas version instead.
- FreeObjectInstance
- Use Classes.pas version instead.
- AllocateHWnd
- Use Classes.pas version instead.
- DeallocateHWnd
Obsolete (in Forms.pas)[]
- Subclass3DWnd
- Subclass3DDlg
- SetAutoSubClass
- DoneCtl3D
- InitCtl3D
StdActnMenus Unit[]
- RegisterStandardMenus
Deprecated Units[]
- OleAuto.pas // replacing with ComObj.pas works in at least part of the cases
- Outline.pas
List of Deprecated elements in Delphi 7[]
Classes Unit[]
- TCollection.Added
- TCollection.Deleting
- Overwrite TCollection.Notify instead
RTLConsts Unit[]
Resource Strings[]
- SConvUnknownDescription
- No longer used
- SInvalidDate
- Moved to SysConst unit
- SInvalidDateTime
- Moved to SysConst unit
- SInvalidInteger
- Moved to SysConst unit
- SInvalidTime
- Moved to SysConst unit
- STimeEncodeError
- Moved to SysConst unit
SysConst Unit[]
Resource Strings[]
- SVarNotArray
- Use SVarInvalid instead
- SWin32Error
- Use SOSError
- SUnkWin32Error
- Use SUnkOSError
- SVarTypeUnknown
- Not used anymore
- SVarTypeOutOfRange
- Not used anymore
- SVarTypeAlreadyUsed
- Not used anymore
- SVarTypeNotUsable
- Not used anymore
- SInvalidVarOpWithHResult
- Not used anymore
System Unit (Default)[]
Const[]
- vmtAfterConstruction
- Use VMTOFFSET in asm code instead
- RaiseList
- Use AcquireExceptionObject instead
- SetRaiseList
- Use AcquireExceptionObject instead
- HPrevInst
- Cannot be tested for multiple instances in Win32
- UnicodeToUtf8
- Use overloaded alternative
- Utf8ToUnicode
- Use overloaded alternative
- TVariantManager
- See Variants unit
- GetVariantManager
- See Variants unit
- SetVariantManager
- See Variants unit
- IsVariantManagerSet
- See Variants unit
Don't use:
- vmtSafeCallException
- vmtBeforeDestruction
- vmtDispatch
- vmtDefaultHandler
- vmtNewInstance
- vmtFreeInstance
- vmtDestroy
- vmtQueryInterface
- vmtAddRef
- vmtRelease
- vmtCreateObject
Unknown:
- Mark
- Release
- TextStart
SysUtils Unit[]
- EStackOverflow
- EWin32Error -> use EOSError (ancestor class of EWin32Error)
- NewStr
- DisposeStr
- AssignStr
- AppendStr
- RaiseLastWin32Error
- Use RaiseLastOSError