وعليكم السلام
التحقق من الاتصال بالانترنت
كود :
function YourFunctionName : boolean;
var
origin : cardinal;
begin
result := InternetGetConnectedState(@origin,0);
//connections origins by origin value
//NO INTERNET CONNECTION = 0;
//INTERNET_CONNECTION_MODEM = 1;
//INTERNET_CONNECTION_LAN = 2;
//INTERNET_CONNECTION_PROXY = 4;
//INTERNET_CONNECTION_MODEM_BUSY = 8;
end;
او جرب
كود :
function TMainF.isInternetConnection: Boolean;
begin
try
IdHTTP.Get('http://www.svtech.cz');
except
on E: Exception do begin
if not (E is EIdHTTPProtocolException) then begin
Result := False;
Exit;
end;
end;
end;
Result := True;
end;
الحصول على التاريخ والوقت
كود :
var
SNTPClient: TIdSNTP;
begin
SNTPClient := TIdSNTP.Create(nil);
try
SNTPClient.Host := 'pool.ntp.org';
SNTPClient.SyncTime;
finally
SNTPClient.Free;
end;
end;
كود :
Label1.Caption := DateToStr(IdSNTP1.DateTime)
+ ' - ' + TimeToStr(IdSNTP1.DateTime);
Label2.Caption := IdSNTP1.Host;
تغيير التاريخ
كود :
var
myDateTime, newDate : TDateTime;
begin
// Set the date to 29/10/2002 at 12:34:56
myDateTime := EncodeDateTime(2002, 10, 29, 12, 34, 56, 0);
ShowMessage('The starting date/time = '+DateTimeToStr(myDateTime));
// Now change the date portion without touching the time
newDate := EncodeDate(1957, 02, 18);
ReplaceDate(myDateTime, newDate);
ShowMessage('The new date/time = '+DateTimeToStr(myDateTime));
end;
تغيير الوقت
كود :
var
myDateTime, newTime : TDateTime;
begin
// Set the date to 29/10/2002 at 12:34:56
myDateTime := EncodeDateTime(2002, 10, 29, 12, 34, 56, 0);
ShowMessage('The starting date/time = '+DateTimeToStr(myDateTime));
// Now change the time portion without touching the date
newTime := EncodeTime(9, 45, 52, 0);
ReplaceTime(myDateTime, newTime);
ShowMessage('The new date/time = '+DateTimeToStr(myDateTime));
end;
قل: اللهم فاطِرَ السماوات والأرض عالم الغيبِ والشهادة، ربَّ كُلِّ شَيءٍ ومَلِيكَه، أَشْهد أن لا إله إلا أنت، أعوذ بك من شرِّ نفسي وشرِّ الشيطان وشِرْكِهِ وأن أقترف على نفسي سوءًا أو أجرُّه إلى مسلم