| 订阅 | 在线投稿
分享
 
 
当前位置: 王朝网络 >> delphi >> zai DELPHI zhong huo de ci pan rong liang

zai DELPHI zhong huo de ci pan rong liang

2006-06-09 19:29:12 编辑來源:互联网 评论
 
 
 
本文为【在DELPHI中获得磁盘容量】的拼音翻译版
  shi yong ru xia API han shu
  BOOL GetDiskFreeSpace(
   LPCTSTR lpRootPathName, // address of root path
   LPDWORD lpSectorsPerCluster, // address of sectors per cluster
   LPDWORD lpBytesPerSector, // address of bytes per sector
   LPDWORD lpNumberOfFreeClusters, // address of number of free clusters
   LPDWORD lpTotalNumberOfClusters // address of total number of clusters
   );
  Parameters
  lpRootPathName
  Points to a null-terminated string that specifies the root directory of the disk to return information about. If lpRootPathName
  is NULL, the function uses the root of the current directory.
  lpSectorsPerCluster
  Points to a variable for the number of sectors per cluster.
  lpBytesPerSector
  Points to a variable for the number of bytes per sector.
  lpNumberOfFreeClusters
  Points to a variable for the total number of free clusters on the disk.
  lpTotalNumberOfClusters
  Points to a variable for the total number of clusters on the disk.
  Return Values
  If the function succeeds, the return value is nonzero.
  If the function fails, the return value is zero. To get extended error information, call GetLastError.
  li zi :
  procedure TForm1.Button1Click(Sender: TObject);
  var DriveString:String;
   sec1, byt1, cl1, cl2: LongWord;
   Disk_FreeSpace : real;
  begin
  GetDiskFreeSpace('d:\', sec1, byt1, cl1, cl2);
  Disk_FreeSpace := (cl1 / (1024*1024*1024))*sec1*byt1;
  showmessage(format(' gai qu dong qi rong liang shi %0.3fG',[Disk_FreeSpace]));
  end;
   shang mian de cheng xu shi jiang shu ju cong zi jie dan wei zhuan huan wei G de , zhi suo yi zhe yang zuo , shi wei le bi mian dang ci pan rong liang da yu DELPHI ji ben shu ju lei xing suo neng cun chu de zui da zhi , bi mian yi chu 。 ru guo xiang huo de yi zi jie wei dan wei de , na me jiang yu dao da shu xiang cheng de wen ti 。
   xia mian ti gong yi ge da shu xiang cheng de suan fa , ta jie shou liang ge zi fu chuan , shu chu zhe ge liang ge zi fu chuan de cheng ji ( dang ran zi fu chuan li dou shi shu zi )
  function TForm1.XAddY(x, y: string): string;
  var
   a,b,c:array[1..1000] of integer;
   i,j,k,l,m,code:integer;
   s,p,r:string;
  begin
   s := x; // liang ge yao xiang cheng de zi fu chuan
   p := y;
   l:=length(s);
   for i:=l downto 1 do
   Val(s[i],a[l-i+1],code);
   m:=length(p);
   for i:=m downto 1 do
   Val(p[i],b[m-i+1],code);
   for j:=1 to m do
   for i:=1 to l do
   begin
   if c[i+j-1]+a[i]*b[j]<=9 then begin
   c[j+i-1]:=c[i+j-1]+a[i]*b[j];
   k:=i+j-1;
   end else begin
   c[j+i-1]:=c[i+j-1]+(a[i]*b[j]) mod 10;
   c[j+i]:=c[j+i]+ c[j+i-1] div 10+ (a[i]*b[j]) div 10;
   c[i+j-1]:=c[i+j-1] mod 10;
   k:=i+j;
   end;
   end;
   r := '';
   for i:=k downto 1 do
   r := r+IntToStr(c[i]);
   Result := r;
  end;
   xia mian wo men jiu ke yi tong guo shi yong da shu xiang cheng de suan fa de de dao ci pan de rong liang ( yong zi jie biao shi )
  procedure TForm1.Button2Click(Sender: TObject);
  var
   sec1, byt1, cl1, cl2: LongWord;
   Disk_FreeSpace : string;
  begin
  GetDiskFreeSpace('d:\', sec1, byt1, cl1, cl2);
  Disk_FreeSpace := XAddY(inttostr(cl1),inttostr(sec1*byt1));
  showmessage(format(' gai qu dong qi rong liang shi %s zi jie ',[Disk_FreeSpace]));
  end;
  
  cheng xu wan zheng de dai ma ru xia :
  unit Unit1;
  interface
  uses
  Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
  Dialogs, StdCtrls;
  type
  TForm1 = class(TForm)
   Button1: TButton;
   Label1: TLabel;
   Label2: TLabel;
   Button2: TButton;
   Label3: TLabel;
   procedure Button1Click(Sender: TObject);
   procedure Button2Click(Sender: TObject);
  private
   { Private declarations }
  public
   function XAddY(x : string;y:string) : string;
  end;
  var
  Form1: TForm1;
  implementation
  {$R *.dfm}
  procedure TForm1.Button1Click(Sender: TObject);
  var DriveString:String;
   sec1, byt1, cl1, cl2: LongWord;
   Disk_FreeSpace : real;
  begin
  GetDiskFreeSpace('d:\', sec1, byt1, cl1, cl2);
  Disk_FreeSpace := (cl1 / (1024*1024*1024))*sec1*byt1;
  showmessage(format(' gai qu dong qi rong liang shi %0.3fG',[Disk_FreeSpace]));
  end;
  function TForm1.XAddY(x, y: string): string;
  var
   a,b,c:array[1..1000] of integer;
   i,j,k,l,m,code:integer;
   s,p,r:string;
  begin
   s := x; // liang ge yao xiang cheng de zi fu chuan
   p := y;
   l:=length(s);
   for i:=l downto 1 do
   Val(s[i],a[l-i+1],code);
   m:=length(p);
   for i:=m downto 1 do
   Val(p[i],b[m-i+1],code);
   for j:=1 to m do
   for i:=1 to l do
   begin
   if c[i+j-1]+a[i]*b[j]<=9 then begin
   c[j+i-1]:=c[i+j-1]+a[i]*b[j];
   k:=i+j-1;
   end else begin
   c[j+i-1]:=c[i+j-1]+(a[i]*b[j]) mod 10;
   c[j+i]:=c[j+i]+ c[j+i-1] div 10+ (a[i]*b[j]) div 10;
   c[i+j-1]:=c[i+j-1] mod 10;
   k:=i+j;
   end;
   end;
   r := '';
   for i:=k downto 1 do
   r := r+IntToStr(c[i]);
   Result := r;
  end;
  procedure TForm1.Button2Click(Sender: TObject);
  var
   sec1, byt1, cl1, cl2: LongWord;
   Disk_FreeSpace : string;
  begin
  GetDiskFreeSpace('d:\', sec1, byt1, cl1, cl2);
  Disk_FreeSpace := XAddY(inttostr(cl1),inttostr(sec1*byt1));
  showmessage(format(' gai qu dong qi rong liang shi %s zi jie ',[Disk_FreeSpace]));
  end;
  end.【原文】【汉音对照
 
 
 
 
 
 
 
 
 
日版宠物情人插曲《Winding Road》歌词

日版宠物情人2017的插曲,很带节奏感,日语的,女生唱的。 最后听见是在第8集的时候女主手割伤了,然后男主用嘴帮她吸了一下,插曲就出来了。 歌手:Def...

兄弟共妻,我成了他们夜里的美食

老钟家的两个儿子很特别,就是跟其他的人不太一样,魔一般的执着。兄弟俩都到了要结婚的年龄了,不管自家老爹怎么磨破嘴皮子,兄弟俩说不娶就不娶,老父母为兄弟两操碎了心...

如何磨出破洞牛仔裤?牛仔裤怎么剪破洞?

把牛仔裤磨出有线的破洞 1、具体工具就是磨脚石,下面垫一个硬物,然后用磨脚石一直磨一直磨,到把那块磨薄了,用手撕开就好了。出来的洞啊很自然的。需要猫须的话调几...

我就是扫描下图得到了敬业福和爱国福

先来看下敬业福和爱国福 今年春节,支付宝再次推出了“五福红包”活动,表示要“把欠大家的敬业福都还给大家”。 今天该活动正式启动,和去年一样,需要收集“五福”...

冰箱异味产生的原因和臭味去除的方法

有时候我们打开冰箱就会闻到一股异味,冰箱里的这种异味是因为一些物质发出的气味的混合体,闻起来让人恶心。 产生这些异味的主要原因有以下几点。 1、很多人有这种习...

 
 
shi yong ru xia API han shu BOOL GetDiskFreeSpace( LPCTSTR lpRootPathName, // address of root path LPDWORD lpSectorsPerCluster, // address of sectors per cluster LPDWORD lpBytesPerSector, // address of bytes per sector LPDWORD lpNumberOfFreeClusters, // address of number of free clusters LPDWORD lpTotalNumberOfClusters // address of total number of clusters ); Parameters lpRootPathName Points to a null-terminated string that specifies the root directory of the disk to return information about. If lpRootPathName is NULL, the function uses the root of the current directory. lpSectorsPerCluster Points to a variable for the number of sectors per cluster. lpBytesPerSector Points to a variable for the number of bytes per sector. lpNumberOfFreeClusters Points to a variable for the total number of free clusters on the disk. lpTotalNumberOfClusters Points to a variable for the total number of clusters on the disk. Return Values If the function succeeds, the return value is nonzero. If the function fails, the return value is zero. To get extended error information, call GetLastError. li zi : procedure TForm1.Button1Click(Sender: TObject); var DriveString:String; sec1, byt1, cl1, cl2: LongWord; Disk_FreeSpace : real; begin GetDiskFreeSpace('d:\', sec1, byt1, cl1, cl2); Disk_FreeSpace := (cl1 / (1024*1024*1024))*sec1*byt1; showmessage(format(' gai qu dong qi rong liang shi %0.3fG',[Disk_FreeSpace])); end; shang mian de cheng xu shi jiang shu ju cong zi jie dan wei zhuan huan wei G de , zhi suo yi zhe yang zuo , shi wei le bi mian dang ci pan rong liang da yu DELPHI ji ben shu ju lei xing suo neng cun chu de zui da zhi , bi mian yi chu 。 ru guo xiang huo de yi zi jie wei dan wei de , na me jiang yu dao da shu xiang cheng de wen ti 。 xia mian ti gong yi ge da shu xiang cheng de suan fa , ta jie shou liang ge zi fu chuan , shu chu zhe ge liang ge zi fu chuan de cheng ji ( dang ran zi fu chuan li dou shi shu zi ) function TForm1.XAddY(x, y: string): string; var a,b,c:array[1..1000] of integer; i,j,k,l,m,code:integer; s,p,r:string; begin s := x; // liang ge yao xiang cheng de zi fu chuan p := y; l:=length(s); for i:=l downto 1 do Val(s[i],a[l-i+1],code); m:=length(p); for i:=m downto 1 do Val(p[i],b[m-i+1],code); for j:=1 to m do for i:=1 to l do begin if c[i+j-1]+a[i]*b[j]<=9 then begin c[j+i-1]:=c[i+j-1]+a[i]*b[j]; k:=i+j-1; end else begin c[j+i-1]:=c[i+j-1]+(a[i]*b[j]) mod 10; c[j+i]:=c[j+i]+ c[j+i-1] div 10+ (a[i]*b[j]) div 10; c[i+j-1]:=c[i+j-1] mod 10; k:=i+j; end; end; r := ''; for i:=k downto 1 do r := r+IntToStr(c[i]); Result := r; end; xia mian wo men jiu ke yi tong guo shi yong da shu xiang cheng de suan fa de de dao ci pan de rong liang ( yong zi jie biao shi ) procedure TForm1.Button2Click(Sender: TObject); var sec1, byt1, cl1, cl2: LongWord; Disk_FreeSpace : string; begin GetDiskFreeSpace('d:\', sec1, byt1, cl1, cl2); Disk_FreeSpace := XAddY(inttostr(cl1),inttostr(sec1*byt1)); showmessage(format(' gai qu dong qi rong liang shi %s zi jie ',[Disk_FreeSpace])); end; cheng xu wan zheng de dai ma ru xia : unit Unit1; interface uses Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms, Dialogs, StdCtrls; type TForm1 = class(TForm) Button1: TButton; Label1: TLabel; Label2: TLabel; Button2: TButton; Label3: TLabel; procedure Button1Click(Sender: TObject); procedure Button2Click(Sender: TObject); private { Private declarations } public function XAddY(x : string;y:string) : string; end; var Form1: TForm1; implementation {$R *.dfm} procedure TForm1.Button1Click(Sender: TObject); var DriveString:String; sec1, byt1, cl1, cl2: LongWord; Disk_FreeSpace : real; begin GetDiskFreeSpace('d:\', sec1, byt1, cl1, cl2); Disk_FreeSpace := (cl1 / (1024*1024*1024))*sec1*byt1; showmessage(format(' gai qu dong qi rong liang shi %0.3fG',[Disk_FreeSpace])); end; function TForm1.XAddY(x, y: string): string; var a,b,c:array[1..1000] of integer; i,j,k,l,m,code:integer; s,p,r:string; begin s := x; // liang ge yao xiang cheng de zi fu chuan p := y; l:=length(s); for i:=l downto 1 do Val(s[i],a[l-i+1],code); m:=length(p); for i:=m downto 1 do Val(p[i],b[m-i+1],code); for j:=1 to m do for i:=1 to l do begin if c[i+j-1]+a[i]*b[j]<=9 then begin c[j+i-1]:=c[i+j-1]+a[i]*b[j]; k:=i+j-1; end else begin c[j+i-1]:=c[i+j-1]+(a[i]*b[j]) mod 10; c[j+i]:=c[j+i]+ c[j+i-1] div 10+ (a[i]*b[j]) div 10; c[i+j-1]:=c[i+j-1] mod 10; k:=i+j; end; end; r := ''; for i:=k downto 1 do r := r+IntToStr(c[i]); Result := r; end; procedure TForm1.Button2Click(Sender: TObject); var sec1, byt1, cl1, cl2: LongWord; Disk_FreeSpace : string; begin GetDiskFreeSpace('d:\', sec1, byt1, cl1, cl2); Disk_FreeSpace := XAddY(inttostr(cl1),inttostr(sec1*byt1)); showmessage(format(' gai qu dong qi rong liang shi %s zi jie ',[Disk_FreeSpace])); end; end.
󰈣󰈤
  免责声明:本文仅代表作者个人观点,与王朝网络无关。王朝网络登载此文出于传递更多信息之目的,并不意味着赞同其观点或证实其描述,其原创性以及文中陈述文字和内容未经本站证实,对本文以及其中全部或者部分内容、文字的真实性、完整性、及时性本站不作任何保证或承诺,请读者仅作参考,并请自行核实相关内容。
 
 
桌球宝贝_性感在蔓延(3)
桌球宝贝_性感在蔓延(2)
银杏树下清纯女孩(9)
银杏树下清纯女孩(8)
痞子的甘南日记
疑是银河落九天
雪域坝上四——纯美色
冬日恋歌——西城杨柳弄轻柔
 
>>返回首页<<
 
 
 为你推荐
 
 
 
 转载本文
 UBB代码 HTML代码
复制到剪贴板...
 
 热帖排行
 
 
 
 
 
©2005- 王朝网络 版权所有