Subject | Re: [ib-support] UDF's |
---|---|
Author | Robert F. Tulloch |
Post date | 2001-08-25T13:35:32Z |
Hi:
How do I use IsMultiThread with this?? It is not recognized.
(Purpose UDF: Clear IB log and delete backups from within app)
Thanks.
Best regards
//---------------------------------------------------------------------------
#include <vcl.h>
#include <windows.h>
#pragma hdrstop
#include "ltudf.h"
//---------------------------------------------------------------------------
int Result;
int __stdcall fn_ClearIbLog(String FilePath)
{
TStringList *IBLog = new TStringList();
try
{
IBLog->LoadFromFile(FilePath);
IBLog->Clear();
IBLog->Add(" ");
String NewHeader = "LTDMS Interbase.Log cleared on " + DateToStr(Date());
IBLog->Add(NewHeader);
IBLog->Add("------------------------------------------------------------");
IBLog->SaveToFile(FilePath);
delete IBLog;
Result = 1;
}
catch(...)
{
delete IBLog;
Result = 0;
}
return Result;
}
int __stdcall fn_DeleteIbBackup(String FilePath)
{
try
{
if (FileExists(FilePath))
{
DeleteFile(FilePath);
Result = 1;
}
else
Result = 0;
}
catch(...)
{
Result = 0;
}
return Result;
}
//---------------------------------------------------------------------------
#pragma argsused
int WINAPI DllEntryPoint(HINSTANCE hinst, unsigned long reason, void* lpReserved)
{
return 1;
}
//---------------------------------------------------------------------------
How do I use IsMultiThread with this?? It is not recognized.
(Purpose UDF: Clear IB log and delete backups from within app)
Thanks.
Best regards
//---------------------------------------------------------------------------
#include <vcl.h>
#include <windows.h>
#pragma hdrstop
#include "ltudf.h"
//---------------------------------------------------------------------------
int Result;
int __stdcall fn_ClearIbLog(String FilePath)
{
TStringList *IBLog = new TStringList();
try
{
IBLog->LoadFromFile(FilePath);
IBLog->Clear();
IBLog->Add(" ");
String NewHeader = "LTDMS Interbase.Log cleared on " + DateToStr(Date());
IBLog->Add(NewHeader);
IBLog->Add("------------------------------------------------------------");
IBLog->SaveToFile(FilePath);
delete IBLog;
Result = 1;
}
catch(...)
{
delete IBLog;
Result = 0;
}
return Result;
}
int __stdcall fn_DeleteIbBackup(String FilePath)
{
try
{
if (FileExists(FilePath))
{
DeleteFile(FilePath);
Result = 1;
}
else
Result = 0;
}
catch(...)
{
Result = 0;
}
return Result;
}
//---------------------------------------------------------------------------
#pragma argsused
int WINAPI DllEntryPoint(HINSTANCE hinst, unsigned long reason, void* lpReserved)
{
return 1;
}
//---------------------------------------------------------------------------