本人按照以前别人的贴子写了做了edit,就是多了个Alignment属性,但是编译后会出现一些warning,请大家帮我看看,谢谢啦
Build
  [Warning] ComCtrls.pas(8366): Symbol 'MakeObjectInstance' is deprecated
  [Warning] ComCtrls.pas(8385): Symbol 'FreeObjectInstance' is deprecated
  [Warning] ComCtrls.pas(13542): Symbol 'MakeObjectInstance' is deprecated
  [Warning] ComCtrls.pas(13543): Symbol 'MakeObjectInstance' is deprecated
  [Warning] ComCtrls.pas(13564): Symbol 'FreeObjectInstance' is deprecated
  [Warning] ComCtrls.pas(13567): Symbol 'FreeObjectInstance' is deprecated
  [Warning] ComCtrls.pas(22122): Symbol 'MakeObjectInstance' is deprecated
  [Warning] ComCtrls.pas(22150): Symbol 'FreeObjectInstance' is deprecated
  [Warning] StdCtrls.pas(2412): Symbol 'FreeObjectInstance' is deprecated
  [Warning] StdCtrls.pas(2413): Symbol 'FreeObjectInstance' is deprecated
  [Warning] Controls.pas(10554): Symbol 'Win32Check' is specific to a platform
  [Warning] Controls.pas(10594): Symbol 'Win32Check' is specific to a platform
下面是我的组件的代码:
unit MyEditEx;interface
{$R MYEDITEX.dcr}
uses Messages, Windows, SysUtils, Classes, Controls, Forms, StdCtrls;type
  TEditEx = class(TCustomEdit)
  private
    { Private declarations }
    FAlignment: TAlignment;
  protected
    { Protected declarations }
    procedure CreateParams(var Params: TCreateParams); override;
    procedure Loaded; override;
    procedure SetAlignment(Value: TAlignment);
  public
    { Public declarations }
    constructor Create(AOwner: TComponent); override;
    destructor Destroy; override;
    function GetControlsAlignment: TAlignment; override;
  published
    { Published declarations }
    property Alignment: TAlignment read FAlignment write SetAlignment default taLeftJustify;
    property Align;
    property Anchors;
    property BevelEdges;
    property BevelInner;
    property BevelKind default bkNone;
    property BevelOuter;
    property BiDiMode;
    property BorderStyle;
    property Color;
    property Constraints;
    property Ctl3D;
    property DragCursor;
    property DragKind;
    property DragMode;
    property Enabled;
    property Font;
    property HideSelection;
    property ImeMode;
    property ImeName;
    property MaxLength;
    property OEMConvert;
    property ParentBiDiMode;
    property ParentColor;
    property ParentCtl3D;
    property ParentFont;
    property ParentShowHint;
    property PopupMenu;
    property ReadOnly;
    property ShowHint;
    property TabOrder;
    property TabStop;
    property Text;
    property Visible;
    property OnChange;
    property OnClick;
    property OnContextPopup;
    property OnDblClick;
    property OnDragDrop;
    property OnDragOver;
    property OnEndDock;
    property OnEndDrag;
    property OnEnter;
    property OnExit;
    property OnKeyDown;
    property OnKeyPress;
    property OnKeyUp;
    property OnMouseDown;
    property OnMouseMove;
    property OnMouseUp;
    property OnStartDock;
    property OnStartDrag;
  end;procedure Register;implementationprocedure Register;
begin
  RegisterComponents('Standard', [TEditEx]);
end;constructor TEditEx.Create(AOwner: TComponent);
begin
  inherited Create(AOwner);
  ParentBackground := False;
end;procedure TEditEx.CreateParams(var Params: TCreateParams);
const
  Alignments: array[Boolean, TAlignment] of DWORD =
    ((ES_LEFT, ES_RIGHT, ES_CENTER),(ES_RIGHT, ES_LEFT, ES_CENTER));
begin
  inherited CreateParams(Params);
  with Params do
  begin
    Style := Style or
      Alignments[UseRightToLeftAlignment, FAlignment];
  end;
end;destructor TEditEx.Destroy();
begin
  inherited Destroy();
end;function TEditEx.GetControlsAlignment: TAlignment;
begin
  Result := FAlignment;
end;procedure TEditEx.Loaded;
begin
  inherited Loaded;
  Modified := False;
end;procedure TEditEx.SetAlignment(Value:TAlignment);
begin
  if FAlignment <> Value then
  begin
    FAlignment := Value;
    RecreateWnd;
  end;
end;end.

解决方案 »

  1.   

    意思是:borland已经提供该函数的替代函数,此处保留只是为了保持向下兼容,但会在后续的某个版本中取消该函数,因此不建议使用该函数。仅此而已。
      

  2.   

    在程序的开始加上这句{$WARN SYMBOL_DEPRECATED OFF}
      

  3.   

    楼上的大哥,谢谢你的回复,但可能我的知识浅薄,看不懂你的解释,而且你说在程序开始加
    是在哪里?dpr里还是窗体里
    能再详细说明下这个warning的涵义吗?
    谢谢啦
      

  4.   

    {$WARN SYMBOL_DEPRECATED OFF}
    unit Unit1;interfaceuses
    ......................
      

  5.   

    呵呵,提示关键字是OP语言中用来标注某个申明过时或者仅仅使用于某个平台或库结构的一种方式,有三种,楼主可以查看帮助....[Warning] StdCtrls.pas(2413): Symbol 'FreeObjectInstance' is deprecated
    这里表示StdCtrls单元的第2413行的函数FreeObjectInstance是一个过时或仅仅是向后兼容的函数[Warning] Controls.pas(10554): Symbol 'Win32Check' is specific to a platform
    而这里表示Ctontrols单元的第10554行的函数Win32Check仅仅是使用于特定平台的----注意使用platform和library的时候是不指定具体平台和库结构的,仅仅是个提示作用对于这样的提示不是在任何情况下都显示的,必须在编译开关 {$HINTS ON} 或{$WARNINGS ON} 的情况下才会显示,所以为了避免显示只要关闭OK了....