This article introduces how to remove advertisements and block Tencent Browser through DELPHI file operations.
Taking OICQ2000b BUILD 0110 as an example, after carefully analyzing the working principle of OICQ, we can find that the advertisements in the "Send Message" window of OICQ are all saved in the AD folder under the OICQ installation directory, and they are all pictures in GIF format. When the file in the AD folder does not exist, OICQ calls the GIF image in the DAT folder, then downloads the advertising image and saves it in the AD folder for calling. As for Tencent browser, you can replace it with Microsoft browser (assuming that the current browser is Microsoft's IE browser).
After understanding this, you can use DELPHI's file operations to remove ads and block Tencent Browser.
As shown in the figure, start DELPHI, create a new project, and place the following controls on the FORM:
Regarding removing advertising banners, the idea is to first read all the GIF format files in the AD folder, then replace them with a small transparent GIF image, and at the same time replace the GIF files in the DAT folder. The program is implemented as follows:
PRocedure TForm1.Del_adClick(Sender: TObject);
var
SearchRec : TsearchRec;
SList: Tstringlist;
Dir, SDir :string;
i, FindResult : integer;
begin
Dir := edit1.Text; //OICQ installation path
SList := Tstringlist.Create; //Used to save the file list
//Determine whether the OICQ installation path is correct
if not fileexists(edit1.text + 'oicq.exe') then
begin
application.MessageBox('The path is incorrect, please choose again!',
'Please reselect',0);
exit;
end;
//Determine whether the end character of the path string is "", if not, add ""
if Dir[length(dir)] <> '' then
Dir := Dir + '';
Dir := Dir + 'AD';
//Find the first GIF file in the folder, and save the file name in SearchRec.
//The returned result is saved in FindResult
FindResult := FindFirst(Dir + '*.gif',FaAnyFile,SearchRec);
try
while FindResult = 0 do //Find successfully
begin
//Add file names to the list
sList.Add(lowercase(Dir + SearchRec.name));
//Continue to find the next file that meets the conditions
FindResult := FindNext(SearchRec);
end;