AdsSyncWriteControlReq
Delphi 5 Programm
unit frmAdsSyncWriteControlReqUnit;
interface
uses
Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,
StdCtrls, TcAdsDef, TcAdsApi, Buttons, ExtCtrls;
type
TfrmAdsSyncWriteControlReq = class(TForm)
Label1: TLabel;
BitBtn1: TBitBtn;
ComboAdsState: TComboBox;
editDevState: TEdit;
Label2: TLabel;
Button1: TButton;
Label3: TLabel;
Bevel1: TBevel;
procedure Button1Click(Sender: TObject);
private
{ Private-Deklarationen }
serverAddr : TAmsAddr;
public
{ Public-Deklarationen }
procedure InitData( destAddr : TAmsAddr );
end;
implementation
{$R *.DFM}
///////////////////////////////////////////////////////////////////////
procedure TfrmAdsSyncWriteControlReq.InitData( destAddr : TAmsAddr);
begin
serverAddr := destAddr;
ComboAdsstate.Items.Add('ADSSTATE_INVALID');
ComboAdsstate.Items.Add('ADSSTATE_IDLE');
ComboAdsstate.Items.Add('ADSSTATE_RESET');
ComboAdsstate.Items.Add('ADSSTATE_INIT');
ComboAdsstate.Items.Add('ADSSTATE_START');
ComboAdsstate.Items.Add('ADSSTATE_RUN');
ComboAdsstate.Items.Add('ADSSTATE_STOP');
ComboAdsstate.Items.Add('ADSSTATE_SAVECFG');
ComboAdsstate.Items.Add('ADSSTATE_LOADCFG');
ComboAdsstate.Items.Add('ADSSTATE_POWERFAILURE');
ComboAdsstate.Items.Add('ADSSTATE_POWERGOOD');
ComboAdsstate.Items.Add('ADSSTATE_ERROR');
ComboAdsstate.Items.Add('ADSSTATE_SHUTDOWN');
ComboAdsstate.Items.Add('ADSSTATE_SUSPEND');
ComboAdsstate.Items.Add('ADSSTATE_RESUME');
ComboAdsstate.Items.Add('ADSSTATE_CONFIG');// system is in config mode
ComboAdsstate.Items.Add('ADSSTATE_RECONFIG');// system should restart in config mode
ComboAdsState.ItemIndex := 5;
end;
///////////////////////////////////////////////////////////////////////
procedure TfrmAdsSyncWriteControlReq.Button1Click(Sender: TObject);
var result : Longint;
begin
result := AdsSyncWriteControlReq( @serverAddr, Word( ComboAdsState.itemIndex ), Word(StrToInt(editDevState.Text)), 0, Nil);
Label3.Caption := Format('AdsSyncWriteControlReq() result: %d [0x%x]',[result,result] );
end;
end.
Dokumente hierzu