Delphi dasturlash tilida OS haqida ma'lumot beruvchi dastur
Assalomu aleykum yana siz bilan Mo'minjon. Bugun siz bilan Delphi dasturlash tilida bitta dastur tuzib chiqamiz. Bu dastur sizning joriy holatda ishlab turgan operatsion sistemangiz haqida qisqacha ma'lumotlar beradi.
Delphi dasturini ishga tushirib olamiz. Keyin, dasturni tepada ko'rib turganingizdek dizaynga keltirib olasiz(O'zingiz qanday hoxlasangiz shunday qiling!) Keyin Buttonning <OnClick> xodisasiga quyidagi kodlarni kiritasiz :
va dasturdagi kodlarimiz quyidagicha ko'rinishga ega bo'ladi :
Endi dasturni Shift + Ctrl + S tugmalarini birgalikda bosib dasturga nom berib saqlaymiz va dasturni Ctrl + F9 tugmalari yordamida kompilyatsiya qilib, dasturni F9 orqali ishga tushiramiz. Endi qolgani o'zingizda.Delphi dasturini ishga tushirib olamiz. Keyin, dasturni tepada ko'rib turganingizdek dizaynga keltirib olasiz(O'zingiz qanday hoxlasangiz shunday qiling!) Keyin Buttonning <OnClick> xodisasiga quyidagi kodlarni kiritasiz :
var
OSVersionInfo : TOSVersionInfo;
begin
OSVersionInfo.dwOSVersionInfoSize := SizeOf(OSVersionInfo);
if GetVersionEx(OSVersionInfo) then
with OSVersionInfo do
begin
WinVerLabel.Caption := Format('%s%s%s%s%s%s%s%s',['Windows:',IntToStr(dwMajorVersion),'.',IntToStr(dwMinorVersion),'(Build ',IntToStr(dwBuildNumber), szCSDVersion,')']);
case dwPlatformId of
0 : WinPlatformLabel.Caption := 'Platform: Win32s on Windows';
1 : WinPlatformLabel.Caption := 'Platform: Win32 on Windows 95';
2 : WinPlatformLabel.Caption := 'Platform: Windows NT';
end;
end;
end;
va dasturdagi kodlarimiz quyidagicha ko'rinishga ega bo'ladi :
procedure TForm1.Button1Click(Sender: TObject);
var
OSVersionInfo : TOSVersionInfo;
begin
OSVersionInfo.dwOSVersionInfoSize := SizeOf(OSVersionInfo);
if GetVersionEx(OSVersionInfo) then
with OSVersionInfo do
begin
WinVerLabel.Caption := Format('%s%s%s%s%s%s%s%s',['Windows:',IntToStr(dwMajorVersion),'.',IntToStr(dwMinorVersion),'(Build ',IntToStr(dwBuildNumber), szCSDVersion,')']);
case dwPlatformId of
0 : WinPlatformLabel.Caption := 'Platform: Win32s on Windows';
1 : WinPlatformLabel.Caption := 'Platform: Win32 on Windows 95';
2 : WinPlatformLabel.Caption := 'Platform: Windows NT';
end;
end;
end;
end.
Keyingi darslarda Delphi dasturlash tilida yana qiziqarli dasturlar tuzishni o'rganamiz.
Comments
Post a Comment
Iltimos, fikrlaringizni yozib qoldiring !