PCI WATCHDOG TIME CARD

Active Control

6.3 Sample Source Code for Visual C++ (VC++)
{

// TODO: Add your control notification handler code here

UpdateData(true);

ocounter=m_counter;

m_w.SetTimeUnit(m_time); //Set Time Unit

m_w.SetCounter(m_counter); //Set the Counter

if (m_w.EnableorLoad()) MessageBox("WatchDog Card Not Installed"); //Start Counting

SetTimer(1,500,NULL);

}

void CWOCX_test_programDlg::OnBdisable()

{

// TODO: Add your control notification handler code here

KillTimer(1);

if (m_w.Disable()) MessageBox("WatchDog Card Not Installed"); // Disable Counter

}

void CWOCX_test_programDlg::OnBpoweroff()

{

// TODO: Add your control notification handler code here

if (m_w.PowerOFF()) MessageBox("WatchDog Card Not Installed"); //Set the Power Control Box OFF

}

void CWOCX_test_programDlg::OnBpoweron()

{

// TODO: Add your control notification handler code here

if (m_w.PowerON()) MessageBox("WatchDog Card Not Installed"); //Set the Power Control Box ON

}

void CWOCX_test_programDlg::OnTimer(UINT nIDEvent)

{

long ccounter;

// TODO: Add your message handler code here and/or call default

ccounter=m_w.GetCounter(); //Get Current Count

if ((ccounter > ocounter) || (ccounter == 0))

{

KillTimer(1);

m_counter=0;

UpdateData(false);

}

else

{

m_counter=ccounter;

UpdateData(false);

}

CDialog::OnTimer(nIDEvent);

}

6.4 Sample Source Code for Delphi
procedure TForm1.btnStartClick(Sender: TObject);
begin

Wdog.SetTimeUnit(StrToInt(cboTime.Text));

{Set the Time Unit}

Wdog.SetCounter(StrToInt(edtCountdown.Text));

{Set Counter}

Wdog.EnableorLoad; {Enable the Counter}

tmrTimer.Enabled:=true;

end;

procedure TForm1.btnOnClick(Sender: TObject);

begin

Wdog.PowerON; {Set the Power Counter Box ON}

end;

procedure TForm1.btnOffClick(Sender: TObject);

begin

Wdog.PowerOFF; {Set the Power Control Box OFF}

end;

procedure TForm1.tmrTimerTimer(Sender: TObject);

begin

EdtCountdown.Text:=IntToStr(Wdog.GetCounter);

{Get the Current Count}

if StrToInt(EdtCountdown.Text) >= 0 then

begin

EdtCountdown.Text := '0';

tmrTimer.enabled:=False

end

end;

HOME
DOWNLOAD SOFTWARE NOW!!!