上記の広告は1ヶ月以上更新のないブログに表示されています。
新しい記事を書く事で広告が消せます。
- --/--/--(--) --:--:--|
- スポンサー広告
-
-
DelphiにはDiskFreeとDiskSizeって関数が用意されている
中身はWin32のGetDiskFreeSpaceExをラップしてるだけです
var
iDiskFree: Int64;
iDiskSize: Int64;
begin
iDiskFree := DiskFree(
3);
Memo1.Lines.Append(
'ディスク空き容量 = ' + FormatCurr(
'#,',iDiskFree));
iDiskSize := DiskSize(
3);
Memo1.Lines.Append(
'ディスク全体 = ' + FormatCurr(
'#,',iDiskSize));
end;
TMemoに書いてみました

DiskFreeとDiskSize両方の引数に3と入れてますけどコレは1=A:, 2=B:,3=C...ドライブ名を数字にしたものです
中身はChar(Drive + $40);です
引数 = 3なので「Cドライブ = Char(
3 +
$40);」
テーマ:プログラミング - ジャンル:コンピュータ
- 2010/06/19(土) 18:16:26|
- Delphi
-
-
DELPHIに付いてる
リソースコンパイラ(
brcc32.exe)
使い方
テキストファイルに
test JPEG "c:\test.jpg"
書いてtest1.rcで保存
DOS窓で「
brcc32.exe test1.rc」
で"test1.res"が出来る
DELPHIから呼ぶ場合TResourceStreamクラスを使う
{$R 'test1.res' 'test1.rc'}var test1: TResourceStream;
begin try
test1 := TResourceStream.Create(HInstance, 'test', 'JPEG');
//test1にStreamが入るので後はご自由に finally test1.Free;
end;end;
テーマ:プログラミング - ジャンル:コンピュータ
- 2009/07/22(水) 18:56:22|
- Delphi
-
-
ディレクトリ(フォルダ)作成の場合
MkDir(),
CreateDir(),
ForceDirectories()などあります
MkDirは戻値無し、CreateDirはBooleanを返します
渡すのは
stringでOK
中身はCreateDirectory APIを読んでるだけ
MkDirは
CreateDirectory(P,
0)
CreateDir は
CreateDirectory(PChar(Dir),
nil)
CreateDirectoryの第2引数がnilと0はなぜ?
ForceDirectoriesは親
ディレクトリを作成しながらCreateDirectory します
(完全修飾パス名でないといけないそうです)
例。
MkDir(
'test_dir');
CreateDir(
'test_dir2');
ForceDirectories(
'c:\test_dir\test_dir\ test_dir');
テーマ:プログラミング - ジャンル:コンピュータ
- 2009/06/03(水) 13:56:07|
- Delphi
-
-
ファイル名変更(
ファイル移動)
RenameFile(
'C:\old.jpg',
'C:\new.jpg');
引数渡すのは
stringでOK
SysUtils.RenameFile内部では
MoveFile API呼んでるだけみたい
成功ならTrueを返す
テーマ:プログラミング - ジャンル:コンピュータ
- 2009/05/27(水) 18:09:45|
- Delphi
-
-
Delphiでファイルを削除する場合
DeleteFile(
'c:\text.txt');
これだけでOK
SysUtilsで
function DeleteFile(
const FileName:
string):
Boolean;
になっているので
stringのままで渡せます
削除できたらTrueを返してます
テーマ:プログラミング - ジャンル:コンピュータ
- 2009/05/22(金) 15:38:04|
- Delphi
-
| トラックバック:0
-