本文所有的窗体界面略去,读者可根据程序自行添加各窗口组件。 |
可以通过Windows API函数GetVersionEx来获得。 |
Procedure Tform1.Button1Click(sender:TObject); |
OSVI.dwOSversioninfoSize:=Sizeof(OSVERSIONINFO); |
label1.Caption:=IntToStr(OSVI.dwMinorVersion)+',' |
+IntToStr(OSVI.dwMinorVersion)+',' |
+IntToStr(OSVI.dwBuildNumber)+',' |
+IntToStr(OSVI.dwPlatformId)+',' |
可以通过Windows API函数GetSystemInfo来获得有关信息。 |
procedure TForm1.Button1Click(Sender: TObject); |
Edit1.Text:='系统中有'+IntToStr(Sysinfo.dwNumberOfProcessors)+'个CPU' |
+',类型为'+IntToStr(Sysinfo.dwProcessorType); |
可以通过Windows API函数GlobalMemoryStatus来获得内存信息。 |
procedure TForm1.Button1Click(Sender: TObject); |
MemInfo.dwLength:=sizeof(MEMORYSTATUS); |
GlobalMemoryStatus(MemInfo); |
memo1.Lines.Add(IntToStr(MemInfo.dwMemoryLoad)+'%的内存正在使用') ; |
memo1.Lines.Add('物理内存共有'+IntToStr(MemInfo.dwTotalPhys)+'字节'); |
memo1.Lines.Add('可使用的物理内存有'+IntToStr(MemInfo.dwAvailPhys)+'字节'); |
memo1.Lines.Add('交换文件总大小为'+IntToStr(MemInfo.dwTotalPageFile)+'字节') ; |
memo1.Lines.Add('尚可交换文件大小为'+IntToStr(MemInfo.dwAvailPageFile)+'字节'); |
memo1.Lines.Add('总虚拟内存有'+IntToStr(MemInfo.dwTotalVirtual)+'字节'); |
memo1.Lines.Add('未用虚拟内存有'+IntToStr(MemInfo.dwAvailVirtual)+'字节'); |
memo1.Text:=IntToStr(MemInfo.dwMemoryLoad)+'%的内存正在使用'+#13#10 |
+'可使用的物理内存有'+IntToStr(MemInfo.dwAvailPhys)+'字节'+#13#10 |
+'交换文件总大小为'+IntToStr(MemInfo.dwTotalPageFile)+'字节'+#13#10 |
+'尚可交换文件大小为'+IntToStr(MemInfo.dwAvailPageFile)+'字节'+#13#10 |
+'总虚拟内存有'+IntToStr(MemInfo.dwTotalVirtual)+'字节'+#13#10 |
+'未用虚拟内存有'+IntToStr(MemInfo.dwAvailVirtual)+'字节'; |
procedure TForm1.Button1Click(Sender: TObject); |
SysDir:array[0..128] of char; |
GetWindowsDirectory(SysDir,128); |
Edit1.Text:='Windows 路径:'+SysDir; |
GetSystemDirectory(SysDir,128); |
Edit1.Text:=Edit1.Text+'; 系统路径:'+SysDir; |
其中,笔者通过更改数列的值:发现其中的128可更改为人以不小于16的的数值,若小于或等于16均出现异常(笔者的操作系统为Windows2000)。读者朋友不妨试试。 |
我们都知道,一般在软件安装过程中,它都会提示用户,要求输入系列号或产品号和用户的一些注册信息(用户的公司名称、用户名等)以及安装的目录和路径等。 |
procedure TForm1.Button1Click(Sender: TObject); |
Reg.RootKey:=HKEY_LOCAL_MACHINE; |
Reg.OpenKey('Software/Microsoft/Windows NT/CurrentVersion',False); |
Edit1.Text:='当前路径:'+Reg.CurrentPath; |
Edit2.Text:='产品系列号:'+Reg.ReadString('ProductId'); |
Edit3.Text:='产品名:'+Reg.ReadString('ProductName'); |
Edit4.Text:='注册公司名称:'+Reg.ReadString('RegisteredOrganization'); |
Edit5.Text:='用户名:'+Reg.ReadString('RegisteredOwner'); |
Edit6.Text:='软件类型:'+Reg.ReadString('SoftwareType'); |
注意:在程序编译之前,必须在USES语句下添加registry单元。 |
可以通过Windows API函数ExitWindowsEx来关闭Widows。 |
procedure TForm1.Button1Click(Sender: TObject); |
if RadioButton1.Checked=true then |
ExitWindowsEx(EWX_LOGOFF,0) //以其他用户身份登录 |
else if RadioButton2.Checked=true then |
ExitWindowsEx(EWX_SHUTDOWN,1) //安全关机 |
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理