Commit 16c9dc7cfb47928fc8c5565ab797a47227e970df
1 parent
5906e45e
Exists in
master
- Exclusão de arquivos desnecessários no repositório
git-svn-id: http://svn.softwarepublico.gov.br/svn/cacic/cacic/trunk/agente-windows@768 fecfc0c7-e812-0410-ae72-849f08638ee7
Showing
7 changed files
with
0 additions
and
485 deletions
Show diff stats
cacicservice/CACICsvc.~dpr
| ... | ... | @@ -1,29 +0,0 @@ |
| 1 | -(** | |
| 2 | ---------------------------------------------------------------------------------------------------------------------------------------------------------------- | |
| 3 | -Copyright 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009 Dataprev - Empresa de Tecnologia e Informações da Previdência Social, Brasil | |
| 4 | - | |
| 5 | -Este arquivo é parte do programa CACIC - Configurador Automático e Coletor de Informações Computacionais | |
| 6 | - | |
| 7 | -O CACIC é um software livre; você pode redistribui-lo e/ou modifica-lo dentro dos termos da Licença Pública Geral GNU como | |
| 8 | -publicada pela Fundação do Software Livre (FSF); na versão 2 da Licença, ou (na sua opinião) qualquer versão. | |
| 9 | - | |
| 10 | -Este programa é distribuido na esperança que possa ser util, mas SEM NENHUMA GARANTIA; sem uma garantia implicita de ADEQUAÇÂO a qualquer | |
| 11 | -MERCADO ou APLICAÇÃO EM PARTICULAR. Veja a Licença Pública Geral GNU para maiores detalhes. | |
| 12 | - | |
| 13 | -Você deve ter recebido uma cópia da Licença Pública Geral GNU, sob o título "LICENCA.txt", junto com este programa, se não, escreva para a Fundação do Software | |
| 14 | -Livre(FSF) Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA | |
| 15 | ---------------------------------------------------------------------------------------------------------------------------------------------------------------- | |
| 16 | -*) | |
| 17 | -program CACICsvc; | |
| 18 | - | |
| 19 | -uses | |
| 20 | - SvcMgr, | |
| 21 | - CACICsvcMain in 'CACICsvcMain.pas' {CACICservice: TService}; | |
| 22 | - | |
| 23 | -{$R *.RES} | |
| 24 | - | |
| 25 | -begin | |
| 26 | - Application.Initialize; | |
| 27 | - Application.CreateForm(TCACICservice, CACICservice); | |
| 28 | - Application.Run; | |
| 29 | -end. |
cacicservice/CACICsvcMain.dcu
No preview for this file type
cacicservice/CACICsvcMain.~ddp
No preview for this file type
cacicservice/CACICsvcMain.~dfm
| ... | ... | @@ -1,20 +0,0 @@ |
| 1 | -object CACICservice: TCACICservice | |
| 2 | - OldCreateOrder = False | |
| 3 | - DisplayName = 'CACICservice' | |
| 4 | - Interactive = True | |
| 5 | - AfterInstall = ServiceAfterInstall | |
| 6 | - OnExecute = ServiceExecute | |
| 7 | - OnStart = ServiceStart | |
| 8 | - OnStop = ServiceStop | |
| 9 | - Left = 192 | |
| 10 | - Top = 107 | |
| 11 | - Height = 375 | |
| 12 | - Width = 544 | |
| 13 | - object Timer_CHKsis: TTimer | |
| 14 | - Enabled = False | |
| 15 | - Interval = 60000 | |
| 16 | - OnTimer = Timer_CHKsisTimer | |
| 17 | - Left = 464 | |
| 18 | - Top = 16 | |
| 19 | - end | |
| 20 | -end |
cacicservice/CACICsvcMain.~pas
| ... | ... | @@ -1,234 +0,0 @@ |
| 1 | -(** | |
| 2 | ---------------------------------------------------------------------------------------------------------------------------------------------------------------- | |
| 3 | -Copyright 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009 Dataprev - Empresa de Tecnologia e Informações da Previdência Social, Brasil | |
| 4 | - | |
| 5 | -Este arquivo é parte do programa CACIC - Configurador Automático e Coletor de Informações Computacionais | |
| 6 | - | |
| 7 | -O CACIC é um software livre; você pode redistribui-lo e/ou modifica-lo dentro dos termos da Licença Pública Geral GNU como | |
| 8 | -publicada pela Fundação do Software Livre (FSF); na versão 2 da Licença, ou (na sua opinião) qualquer versão. | |
| 9 | - | |
| 10 | -Este programa é distribuido na esperança que possa ser util, mas SEM NENHUMA GARANTIA; sem uma garantia implicita de ADEQUAÇÂO a qualquer | |
| 11 | -MERCADO ou APLICAÇÃO EM PARTICULAR. Veja a Licença Pública Geral GNU para maiores detalhes. | |
| 12 | - | |
| 13 | -Você deve ter recebido uma cópia da Licença Pública Geral GNU, sob o título "LICENCA.txt", junto com este programa, se não, escreva para a Fundação do Software | |
| 14 | -Livre(FSF) Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA | |
| 15 | ---------------------------------------------------------------------------------------------------------------------------------------------------------------- | |
| 16 | -*) | |
| 17 | -unit CACICsvcMain; | |
| 18 | - | |
| 19 | -interface | |
| 20 | - | |
| 21 | -uses | |
| 22 | - Windows, Messages, SysUtils, Classes, SvcMgr,strutils, ExtCtrls; | |
| 23 | - | |
| 24 | -var strHomeDrive, | |
| 25 | - strCacicDir : String; | |
| 26 | - boolStarted : boolean; | |
| 27 | - | |
| 28 | -type | |
| 29 | - TCACICservice = class(TService) | |
| 30 | - Timer_CHKsis: TTimer; | |
| 31 | - procedure ServiceExecute(Sender: TService); | |
| 32 | - procedure ServiceStart(Sender: TService; var Started: Boolean); | |
| 33 | - procedure ServiceAfterInstall(Sender: TService); | |
| 34 | - procedure Timer_CHKsisTimer(Sender: TObject); | |
| 35 | - procedure ServiceStop(Sender: TService; var Stopped: Boolean); | |
| 36 | - private | |
| 37 | - | |
| 38 | - { Internal Start & Stop methods } | |
| 39 | - function HomeDrive : string; | |
| 40 | - function GetValorChaveRegIni(p_Secao, p_Chave, p_File : String): String; | |
| 41 | - function GetAppPath: String; | |
| 42 | - procedure doSaveLog(Msg : String); | |
| 43 | - Procedure WMEndSession(var Msg : TWMEndSession) ; message WM_ENDSESSION; | |
| 44 | - procedure ExecutaCACIC; | |
| 45 | - public | |
| 46 | - { Public declarations } | |
| 47 | - | |
| 48 | - function GetServiceController: TServiceController; override; | |
| 49 | - end; | |
| 50 | - | |
| 51 | -var | |
| 52 | - CACICservice: TCACICservice; | |
| 53 | - | |
| 54 | -implementation | |
| 55 | - | |
| 56 | -{$R *.DFM} | |
| 57 | -procedure TCACICservice.WMEndSession(var Msg : TWMEndSession) ; | |
| 58 | -begin | |
| 59 | - if Msg.EndSession = TRUE then | |
| 60 | - doSaveLog('Windows finalizado em ' + FormatDateTime('c', Now)) ; | |
| 61 | - inherited; | |
| 62 | - Application.Free; | |
| 63 | -end; | |
| 64 | -// Funções Auxiliares | |
| 65 | -function TCACICservice.GetValorChaveRegIni(p_Secao, p_Chave, p_File : String): String; | |
| 66 | -//Para buscar do Arquivo INI... | |
| 67 | -// Marreta devido a limitações do KERNEL w9x no tratamento de arquivos texto e suas seções | |
| 68 | -//function GetValorChaveRegIni(p_SectionName, p_KeyName, p_IniFileName : String) : String; | |
| 69 | -var | |
| 70 | - FileText : TStringList; | |
| 71 | - i, j, v_Size_Section, v_Size_Key : integer; | |
| 72 | - v_SectionName, v_KeyName : string; | |
| 73 | - begin | |
| 74 | -//doSaveLog('GetVCRini: Secao: '+p_Secao+' Chave: '+p_Chave+' File: '+p_File); | |
| 75 | - Result := ''; | |
| 76 | - v_SectionName := '[' + p_Secao + ']'; | |
| 77 | - v_Size_Section := strLen(PChar(v_SectionName)); | |
| 78 | - v_KeyName := p_Chave + '='; | |
| 79 | - v_Size_Key := strLen(PChar(v_KeyName)); | |
| 80 | - FileText := TStringList.Create; | |
| 81 | - try | |
| 82 | - FileText.LoadFromFile(p_File); | |
| 83 | - For i := 0 To FileText.Count - 1 Do | |
| 84 | - Begin | |
| 85 | - if (LowerCase(Trim(PChar(Copy(FileText[i],1,v_Size_Section)))) = LowerCase(Trim(PChar(v_SectionName)))) then | |
| 86 | - Begin | |
| 87 | - For j := i to FileText.Count - 1 Do | |
| 88 | - Begin | |
| 89 | - if (LowerCase(Trim(PChar(Copy(FileText[j],1,v_Size_Key)))) = LowerCase(Trim(PChar(v_KeyName)))) then | |
| 90 | - Begin | |
| 91 | - Result := PChar(Copy(FileText[j],v_Size_Key + 1,strLen(PChar(FileText[j]))-v_Size_Key)); | |
| 92 | - Break; | |
| 93 | - End; | |
| 94 | - End; | |
| 95 | - End; | |
| 96 | - if (Result <> '') then break; | |
| 97 | - End; | |
| 98 | - finally | |
| 99 | - FileText.Free; | |
| 100 | - end; | |
| 101 | - end; | |
| 102 | - | |
| 103 | -function TCACICservice.GetAppPath: String; | |
| 104 | -Var | |
| 105 | - Test : String; | |
| 106 | - Res : Longint; | |
| 107 | - CurSize : Longint; | |
| 108 | -begin | |
| 109 | - CurSize := 1024; | |
| 110 | - SetLength(Test, CurSize); | |
| 111 | - Res := GetModuleFilename(GetModuleHandle(nil), PChar(test), CurSize); | |
| 112 | - If (res > curSize) then | |
| 113 | - begin | |
| 114 | - CurSize := res + 10; | |
| 115 | - SetLength(Test, CurSize); | |
| 116 | - Res := GetModuleFilename(GetModuleHandle(nil), PChar(test), CurSize); | |
| 117 | - end; | |
| 118 | - Setlength(Test, Res); | |
| 119 | - test := ExtractFileDir(Test); | |
| 120 | - if (test[Length(test)] = '\') or (test[Length(test)]='/') then | |
| 121 | - SetLength(Test, Length(test) - 1); | |
| 122 | - Result := test; | |
| 123 | -end; | |
| 124 | - | |
| 125 | -function TCACICservice.HomeDrive : string; | |
| 126 | -var WinDir : array [0..144] of char; | |
| 127 | -begin | |
| 128 | - GetWindowsDirectory (WinDir, 144); | |
| 129 | - Result := StrPas (WinDir); | |
| 130 | -end; | |
| 131 | - | |
| 132 | -procedure TCACICservice.doSaveLog(Msg : String); | |
| 133 | -var fLog: textfile; | |
| 134 | -begin | |
| 135 | - AssignFile(fLog, HomeDrive + '\CACICsvc.log'); | |
| 136 | - if FileExists(HomeDrive + '\CACICsvc.log') then | |
| 137 | - Append(fLog) | |
| 138 | - else | |
| 139 | - Rewrite(fLog); | |
| 140 | - Writeln(fLog,FormatDateTime('dd/mm hh:nn:ss ', Now) + '[CACICsvc] : ' +msg); | |
| 141 | - CloseFile(fLog); | |
| 142 | -End; | |
| 143 | - | |
| 144 | -procedure ServiceController(CtrlCode: DWord); stdcall; | |
| 145 | -begin | |
| 146 | - CACICservice.Controller(CtrlCode); | |
| 147 | -end; | |
| 148 | - | |
| 149 | -function TCACICservice.GetServiceController: TServiceController; | |
| 150 | -begin | |
| 151 | - Result := ServiceController; | |
| 152 | -end; | |
| 153 | - | |
| 154 | -procedure TCACICservice.ServiceExecute(Sender: TService); | |
| 155 | -begin | |
| 156 | - doSaveLog('TCACICservice.ServiceExecute'); | |
| 157 | - | |
| 158 | - { Loop while service is active in SCM } | |
| 159 | - While NOT Terminated do | |
| 160 | - Begin | |
| 161 | - { Process Service Requests } | |
| 162 | - ServiceThread.ProcessRequests( False ); | |
| 163 | - { Allow system some time } | |
| 164 | - Sleep(1); | |
| 165 | - End; | |
| 166 | -end; | |
| 167 | - | |
| 168 | -procedure TCACICservice.ServiceStart(Sender: TService; var Started: Boolean); | |
| 169 | -begin | |
| 170 | - | |
| 171 | - Started := true; | |
| 172 | - | |
| 173 | - ExecutaCACIC; | |
| 174 | - | |
| 175 | - Timer_CHKsis.Interval := 60000; | |
| 176 | - Timer_CHKsis.Enabled := true; | |
| 177 | - | |
| 178 | - While not Terminated do | |
| 179 | - Sleep(250); | |
| 180 | - | |
| 181 | - | |
| 182 | -end; | |
| 183 | - | |
| 184 | -procedure TCACICservice.ExecutaCACIC; | |
| 185 | -Begin | |
| 186 | - | |
| 187 | - strHomeDrive := MidStr(HomeDrive,1,3); //x:\ | |
| 188 | - strCacicDir := strHomeDrive + GetValorChaveRegIni('Cacic2', 'cacic_dir', GetAppPath + '\chksis.ini'); | |
| 189 | - | |
| 190 | - DeleteFile(strCacicDir + '\aguarde_CACIC.txt'); | |
| 191 | - Sleep(3000); | |
| 192 | - | |
| 193 | - // Se o arquivo indicador de execução não existir... | |
| 194 | - if not (FileExists(strCacicDir + '\aguarde_CACIC.txt')) then | |
| 195 | - Begin | |
| 196 | - // Executo o CHKsis, verificando a estrutura do sistema | |
| 197 | - Try | |
| 198 | - WinEXEC(PChar(HomeDrive + '\chksis.exe'),sw_HIDE); | |
| 199 | - Except | |
| 200 | - End; | |
| 201 | - | |
| 202 | - While not (FileExists(strCacicDir + '\cacic2.exe')) do | |
| 203 | - Sleep(5000); // Espero 5 segundos... | |
| 204 | - End; | |
| 205 | - | |
| 206 | - | |
| 207 | - // Executo o Agente Principal do CACIC | |
| 208 | - Try | |
| 209 | - WinEXEC(PChar(strCacicDir + '\cacic2.exe'),sw_hide); | |
| 210 | - Except | |
| 211 | - End; | |
| 212 | -End; | |
| 213 | - | |
| 214 | -procedure TCACICservice.ServiceAfterInstall(Sender: TService); | |
| 215 | - | |
| 216 | -begin | |
| 217 | - ServiceStart(nil,boolStarted); | |
| 218 | -end; | |
| 219 | - | |
| 220 | -procedure TCACICservice.Timer_CHKsisTimer(Sender: TObject); | |
| 221 | -begin | |
| 222 | - ExecutaCACIC; | |
| 223 | - | |
| 224 | - // Verificações diversas | |
| 225 | - | |
| 226 | -end; | |
| 227 | - | |
| 228 | -procedure TCACICservice.ServiceStop(Sender: TService; | |
| 229 | - var Stopped: Boolean); | |
| 230 | -begin | |
| 231 | - Stopped := true; | |
| 232 | -end; | |
| 233 | - | |
| 234 | -end. |
cacicservice/CACICsvcThread.dcu
No preview for this file type
cacicservice/CACICsvcThread.~pas
| ... | ... | @@ -1,202 +0,0 @@ |
| 1 | -(* | |
| 2 | - A Windows NT Service Thread | |
| 3 | - =========================== | |
| 4 | - | |
| 5 | - Author Kim Sandell | |
| 6 | - Email: kim.sandell@nsftele.com | |
| 7 | -*) | |
| 8 | -unit CACICsvcThread; | |
| 9 | - | |
| 10 | -interface | |
| 11 | - | |
| 12 | -uses | |
| 13 | - Windows, Messages, SysUtils, Classes, StrUtils; | |
| 14 | - | |
| 15 | -var strHomeDrive, | |
| 16 | - strCacicDir : String; | |
| 17 | - | |
| 18 | -type | |
| 19 | - TNTServiceThread = Class(TThread) | |
| 20 | - private | |
| 21 | - { Private declarations } | |
| 22 | - function HomeDrive : string; | |
| 23 | - function GetValorChaveRegIni(p_Secao, p_Chave, p_File : String): String; | |
| 24 | - function GetAppPath: String; | |
| 25 | - procedure doSaveLog(Msg : String); | |
| 26 | - function CreateProcessSimple(sExecutableFilePath : string ) : String; | |
| 27 | - Public | |
| 28 | - { Public declarations } | |
| 29 | - Interval : Integer; | |
| 30 | - | |
| 31 | - Procedure Execute; Override; | |
| 32 | - Published | |
| 33 | - { Published declarations } | |
| 34 | - End; | |
| 35 | - | |
| 36 | -implementation | |
| 37 | - | |
| 38 | -{ TNTServiceThread } | |
| 39 | -// Funções Auxiliares | |
| 40 | -function TNTServiceThread.GetValorChaveRegIni(p_Secao, p_Chave, p_File : String): String; | |
| 41 | -//Para buscar do Arquivo INI... | |
| 42 | -// Marreta devido a limitações do KERNEL w9x no tratamento de arquivos texto e suas seções | |
| 43 | -//function GetValorChaveRegIni(p_SectionName, p_KeyName, p_IniFileName : String) : String; | |
| 44 | -var | |
| 45 | - FileText : TStringList; | |
| 46 | - i, j, v_Size_Section, v_Size_Key : integer; | |
| 47 | - v_SectionName, v_KeyName : string; | |
| 48 | - begin | |
| 49 | -//doSaveLog('GetVCRini: Secao: '+p_Secao+' Chave: '+p_Chave+' File: '+p_File); | |
| 50 | - Result := ''; | |
| 51 | - v_SectionName := '[' + p_Secao + ']'; | |
| 52 | - v_Size_Section := strLen(PChar(v_SectionName)); | |
| 53 | - v_KeyName := p_Chave + '='; | |
| 54 | - v_Size_Key := strLen(PChar(v_KeyName)); | |
| 55 | - FileText := TStringList.Create; | |
| 56 | - try | |
| 57 | - FileText.LoadFromFile(p_File); | |
| 58 | - For i := 0 To FileText.Count - 1 Do | |
| 59 | - Begin | |
| 60 | - if (LowerCase(Trim(PChar(Copy(FileText[i],1,v_Size_Section)))) = LowerCase(Trim(PChar(v_SectionName)))) then | |
| 61 | - Begin | |
| 62 | - For j := i to FileText.Count - 1 Do | |
| 63 | - Begin | |
| 64 | - if (LowerCase(Trim(PChar(Copy(FileText[j],1,v_Size_Key)))) = LowerCase(Trim(PChar(v_KeyName)))) then | |
| 65 | - Begin | |
| 66 | - Result := PChar(Copy(FileText[j],v_Size_Key + 1,strLen(PChar(FileText[j]))-v_Size_Key)); | |
| 67 | - Break; | |
| 68 | - End; | |
| 69 | - End; | |
| 70 | - End; | |
| 71 | - if (Result <> '') then break; | |
| 72 | - End; | |
| 73 | - finally | |
| 74 | - FileText.Free; | |
| 75 | - end; | |
| 76 | - end; | |
| 77 | - | |
| 78 | -function TNTServiceThread.GetAppPath: String; | |
| 79 | -Var | |
| 80 | - Test : String; | |
| 81 | - Res : Longint; | |
| 82 | - CurSize : Longint; | |
| 83 | -begin | |
| 84 | - CurSize := 1024; | |
| 85 | - SetLength(Test, CurSize); | |
| 86 | - Res := GetModuleFilename(GetModuleHandle(nil), PChar(test), CurSize); | |
| 87 | - If (res > curSize) then | |
| 88 | - begin | |
| 89 | - CurSize := res + 10; | |
| 90 | - SetLength(Test, CurSize); | |
| 91 | - Res := GetModuleFilename(GetModuleHandle(nil), PChar(test), CurSize); | |
| 92 | - end; | |
| 93 | - Setlength(Test, Res); | |
| 94 | - test := ExtractFileDir(Test); | |
| 95 | - if (test[Length(test)] = '\') or (test[Length(test)]='/') then | |
| 96 | - SetLength(Test, Length(test) - 1); | |
| 97 | - Result := test; | |
| 98 | -end; | |
| 99 | - | |
| 100 | -function TNTServiceThread.HomeDrive : string; | |
| 101 | -var WinDir : array [0..144] of char; | |
| 102 | -begin | |
| 103 | - GetWindowsDirectory (WinDir, 144); | |
| 104 | - Result := StrPas (WinDir); | |
| 105 | -end; | |
| 106 | - | |
| 107 | -procedure TNTServiceThread.doSaveLog(Msg : String); | |
| 108 | -var fLog: textfile; | |
| 109 | -begin | |
| 110 | - AssignFile(fLog, strHomeDrive + 'CACICsvc.log'); | |
| 111 | - if FileExists(strHomeDrive + 'CACICsvc.log') then | |
| 112 | - Append(fLog) | |
| 113 | - else | |
| 114 | - Rewrite(fLog); | |
| 115 | - Writeln(fLog,FormatDateTime('dd/mm hh:nn:ss ', Now) + '[CACICsvc] : ' +msg); | |
| 116 | - CloseFile(fLog); | |
| 117 | -End; | |
| 118 | - | |
| 119 | -function TNTServiceThread.CreateProcessSimple(sExecutableFilePath : string ) : string; | |
| 120 | -var | |
| 121 | - pi: TProcessInformation; | |
| 122 | - si: TStartupInfo; | |
| 123 | -begin | |
| 124 | - FillMemory( @si, sizeof( si ), 0 ); | |
| 125 | - si.cb := sizeof( si ); | |
| 126 | - | |
| 127 | - CreateProcess( | |
| 128 | - Nil, | |
| 129 | - PChar( sExecutableFilePath ), | |
| 130 | - Nil, Nil, False, | |
| 131 | - NORMAL_PRIORITY_CLASS, Nil, Nil, | |
| 132 | - si, pi ); | |
| 133 | - | |
| 134 | - // "after calling code" such as | |
| 135 | - // the code to wait until the | |
| 136 | - // process is done should go here | |
| 137 | - | |
| 138 | - CloseHandle( pi.hProcess ); | |
| 139 | - CloseHandle( pi.hThread ); | |
| 140 | -end; | |
| 141 | - | |
| 142 | -procedure TNTServiceThread.Execute; | |
| 143 | -begin | |
| 144 | - strHomeDrive := MidStr(HomeDrive,1,3); //x:\ | |
| 145 | - doSaveLog('strHomeDrive: '+strHomeDrive); | |
| 146 | - | |
| 147 | - strCacicDir := strHomeDrive + GetValorChaveRegIni('Cacic2', 'cacic_dir', GetAppPath + '\chksis.ini'); | |
| 148 | - doSaveLog('strCacicDir: '+strCacicDir); | |
| 149 | - | |
| 150 | - // Executo o CHKsis, verificando a estrutura do sistema | |
| 151 | - Try | |
| 152 | - CreateProcessSimple(PChar(HomeDrive + '\chksis.exe')); | |
| 153 | - Except | |
| 154 | - End; | |
| 155 | - | |
| 156 | - While not (FileExists(strCacicDir + '\cacic2.exe')) do | |
| 157 | - Sleep(5000); // Espero 5 segundos... | |
| 158 | - | |
| 159 | - // Executo o Agente Principal do CACIC | |
| 160 | - Try | |
| 161 | - doSaveLog('Executarei "'+strCacicDir + '\cacic2.exe"'); | |
| 162 | - CreateProcessSimple(PChar(strCacicDir + '\cacic2.exe')); | |
| 163 | - Except | |
| 164 | - End; | |
| 165 | - | |
| 166 | - While not Terminated do | |
| 167 | - Sleep(250); | |
| 168 | - | |
| 169 | - { | |
| 170 | - // Do NOT free on termination - The Serivce frees the Thread | |
| 171 | - FreeOnTerminate := False; | |
| 172 | - | |
| 173 | - // Set Interval | |
| 174 | - TimeOut := Interval * 4; | |
| 175 | - | |
| 176 | - // Main Loop | |
| 177 | - Try | |
| 178 | - While Not Terminated do | |
| 179 | - Begin | |
| 180 | - // Decrement timeout | |
| 181 | - Dec( TimeOut ); | |
| 182 | - | |
| 183 | - If (TimeOut=0) then | |
| 184 | - Begin | |
| 185 | - // Reset timer | |
| 186 | - TimeOut := Interval * 4; | |
| 187 | - | |
| 188 | - // Beep once per x seconds | |
| 189 | - Beep; | |
| 190 | - End; | |
| 191 | - // Wait 1/4th of a second | |
| 192 | - Sleep(250); | |
| 193 | - End; | |
| 194 | - Except | |
| 195 | - On E:Exception do ; // TODO: Exception logging... | |
| 196 | - End; | |
| 197 | - // Terminate the Thread - This signals Terminated=True | |
| 198 | - Terminate; | |
| 199 | - } | |
| 200 | -end; | |
| 201 | - | |
| 202 | -end. |