AdsSyncReadStateReq
Delphi 5 Programm
unit frmAdsSyncReadStateReqUnit;
interface
uses
Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,
StdCtrls, TcAdsDef, TcAdsApi, Buttons, ExtCtrls;
type
TfrmAdsSyncReadStateReq = 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 TfrmAdsSyncReadStateReq.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
Button1Click( self );
end;
///////////////////////////////////////////////////////////////////////
procedure TfrmAdsSyncReadStateReq.Button1Click(Sender: TObject);
var result : Longint;
adsState, devState : Word;
begin
adsState := 0;
devState := 0;
result := AdsSyncReadStateReq( @serverAddr, @adsState, @devState);
ComboAdsState.ItemIndex := adsState;
editDevState.Text := IntToStr(devState);
Label3.Caption := Format('AdsSyncReadStateReq() result: %d [0x%x]',[result,result] );
end;
end.
Dokumente hierzu