0
I have the following problem, I have a function in Delphi that runs online a PHP file that provides the SERIAL of the PROGRAM It happens, that when I run this function it keeps taking the same SERIAL, because it stays in the CACHE of the Machine. I know there is a FLAG that RELOAD in Wininet, something similar to clear the cache, some help ?
Follows my code:
function DownloadSerial(const Origem: string): string;
var
SessaoHandle, UrlHandle : Pointer;
TamanhoDados : DWORD;
Dados : Array[0..1024] of Char;
ABC: HMODULE;
begin
Result := '';
if (not Assigned(@InternetOpenA) or not Assigned(@InternetOpenUrlA) or not Assigned(@InternetReadFile) or not Assigned(@InternetCloseHandle)) then
begin
ABC := LoadLibrary( pChar('wininet.dll')) );
if ABC <> 0 then
begin
@InternetOpenA := GetProcAddress(ABC, pChar('InternetOpenA')));
@InternetOpenUrlA := GetProcAddress(ABC, pChar('InternetOpenUrlA')));
@InternetReadFile := GetProcAddress(ABC, pChar('InternetReadFile')));
@InternetCloseHandle := GetProcAddress(ABC, pChar('InternetCloseHandle')));
end;
end;
if (Assigned(@InternetOpenA) and Assigned(@InternetOpenUrlA) and Assigned(@InternetReadFile) and Assigned(@InternetCloseHandle)) then
begin
SessaoHandle := InternetOpenA(nil, 0, nil, nil, 0);
UrlHandle := InternetOpenUrlA(SessaoHandle, pChar(Origem), nil, 0, 0, 0);
if UrlHandle <> nil then
begin
repeat
InternetReadFile(UrlHandle, @Dados, SizeOf(Dados), TamanhoDados); //saida := saida + lpBuffer;
Result := Result + string(Dados);
until TamanhoDados = 0;
end;
InternetCloseHandle(UrlHandle);
InternetCloseHandle(SessaoHandle);
end;
end;
Thanks for the help @Sunstreaker, but unfortunately it didn’t work. I put a button that runs that function above. I click once it takes the first serial, I click again, should take the next one from the list, because the previous one has already been deleted, and unfortunately it continues to take the previous one. What could it be? We forgot something ?
– user7605
it worked yes, with that second reply...thanks friend!
– user7605
I am testing now..... let me see if I can adapt here that I already mark the answer. Thank you!
– user7605