请问可有这方面的例程或代码,请告之。
解决方案 »
- moveto 和 lineto问题
- 【求助】用delphi设计一个公司局域网的监控系统
- 数值类型转换
- 请问如何做信息搜索系统?各位兄弟给个思路
- 国庆上班,,郁闷!!!兄弟们接分!!1
- 很怪的问题
- DELPHI5 TADOTABLE 有批量更新吗!!!涉及到SQL INSERT 的调优 急!急!急!
- 请问用delphi编写与硬件的接口可以吗??
- 有什么方法可以使得TDateTimePicker不显示任何内容!
- 请问怎样激活popupmenu的menuitemclick事件 ?我这样写为什么不起作用?
- 本公司急招熟练使用DEPHI+SQL SERVER2000的程序员4名,专兼职均可
- hint 问题
Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,
StdCtrls, ExtCtrls;type
TForm1 = class(TForm)
Panel1: TPanel;
StaticText1: TStaticText;
StaticText2: TStaticText;
StaticText3: TStaticText;
StaticText4: TStaticText;
StaticText5: TStaticText;
Edit1: TEdit;
Edit2: TEdit;
Edit3: TEdit;
Edit4: TEdit;
Edit5: TEdit;
Button1: TButton;
procedure Button1Click(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;var
Form1: TForm1;implementation{$R *.DFM}procedure TForm1.Button1Click(Sender: TObject);
var
OSVI:OSVERSIONINFO;
s:string;
is98orlater:boolean;
begin
OSVI.dwOSVersionInfoSize:=sizeof(OSVERSIONINFO);
//设置版本信息结构的大小
GetVersionEx(OSVI);
//获取版本信息
is98orlater:=
//判断是否98或以后版本
(osvi.dwPlatformId=VER_PLATFORM_WIN32_WINDOWS) and
((osvi.dwMajorVersion>4) or
((osvi.dwMajorVersion=4) and (osvi.dwMinorVersion>0))); //下面开始显示信息
case OSVI.dwPlatformId of
//根据OSVI.dwPlatformId的数值的不同显示具体的平台描述
VER_PLATFORM_WIN32s:
// Windows 3.1平台
s:='Windows 3.1';
VER_PLATFORM_WIN32_WINDOWS:
// Windows 95/98平台
if(is98orlater) then
//98
s:='Windows 98'
else
//95
s:='Windows 95';
VER_PLATFORM_WIN32_NT:
// Windows NT平台
s:='Windows NT';
end; Edit1.Text:=s;
Edit2.Text:=IntToStr(OSVI.dwMajorVersion);
Edit3.Text:=IntToStr(OSVI.dwMinorVersion);
case OSVI.dwPlatformId of
//根据平台的不同具体处理OSVI.dwBuildNumber信息
VER_PLATFORM_WIN32_WINDOWS:
// Windows 95/98平台则取OSVI.dwBuildNumber的低位字
Edit4.Text:=IntToStr(LOWORD(OSVI.dwBuildNumber));
VER_PLATFORM_WIN32_NT:
// Windows NT平台则取所有位的值
Edit4.Text:=IntToStr(OSVI.dwBuildNumber);
else
Edit4.Text:='';
// Windows 3.1平台此值位空
end;
Edit5.Text:=OSVI.szCSDVersion;
end;end.
Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,
StdCtrls, ExtCtrls;type
TForm1 = class(TForm)
Panel1: TPanel;
StaticText1: TStaticText;
StaticText2: TStaticText;
StaticText3: TStaticText;
StaticText4: TStaticText;
StaticText5: TStaticText;
StaticText6: TStaticText;
StaticText7: TStaticText;
Edit1: TEdit;
Edit2: TEdit;
Edit3: TEdit;
Edit4: TEdit;
Edit5: TEdit;
Edit6: TEdit;
Edit7: TEdit;
Button1: TButton;
procedure Button1Click(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;var
Form1: TForm1;implementation{$R *.DFM}procedure TForm1.Button1Click(Sender: TObject);
var
MemInfo:MEMORYSTATUS;
begin
MemInfo.dwLength:=sizeof(MEMORYSTATUS);
//用sizeof(MEMORYSTATUS)填充dwLength成员
GlobalMemoryStatus(MemInfo);
//获取内存信息
Edit1.Text:=IntToStr(MemInfo.dwMemoryLoad)+'%';
//内存使用百分比
Edit2.Text:=IntToStr(MemInfo.dwTotalPhys);
//总物理内存(字节)
Edit3.Text:=IntToStr(MemInfo.dwAvailPhys);
//未使用物理内存(字节)
Edit4.Text:=IntToStr(MemInfo.dwTotalPageFile);
//交换文件大小(字节)
Edit5.Text:=IntToStr(MemInfo.dwAvailPageFile);
//未使用交换文件大小(字节)
Edit6.Text:=IntToStr(MemInfo.dwTotalVirtual);
//虚拟内存空间大小(字节)
Edit7.Text:=IntToStr(MemInfo.dwAvailVirtual);
//未使用虚拟内存大小(字节)
end;end.
Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,
ExtCtrls, StdCtrls;type
TForm1 = class(TForm)
StaticText1: TStaticText;
StaticText2: TStaticText;
StaticText3: TStaticText;
ComboBox1: TComboBox;
Edit1: TEdit;
Edit2: TEdit;
Panel1: TPanel;
StaticText4: TStaticText;
StaticText5: TStaticText;
procedure ComboBox1Change(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;var
Form1: TForm1;implementation{$R *.DFM}procedure TForm1.ComboBox1Change(Sender: TObject);
var
secspclu,bytespsec,freeclu,totalclu,ts,fs:DWord;
begin
GetDiskFreeSpace(PChar(ComboBox1.Items[ComboBox1.ItemIndex]),secspclu,bytespsec,freeclu,totalclu);
fs:=freeclu*secspclu*bytespsec;
//磁盘的剩余空间(字节为单位)
ts:=totalclu*secspclu*bytespsec;
//磁盘的总容量(字节为单位)
edit2.text:=formatfloat('###,###',fs);
edit1.text:=formatfloat('###,###',ts);
//将结果格式化并显示在两个TEdit组件中
end;end.