[轉貼]取得檔案屬性頁面

有關Delphi 的語法, 程式, 等
回覆文章
頭像
tim
文章: 1380
註冊時間: 2008年 11月 26日, 00:49

[轉貼]取得檔案屬性頁面

文章 tim »

參考網頁: http://members.lycos.co.uk/nirsoft/vc/fprops.html

轉為 delphi 的語法:
使用 ShellAPI unit

代碼: 選擇全部

procedure Tform1.Button1Click(Sender: TObject);
var
 ShExecInfo: TShellExecuteInfoA;
 filename: string;
begin
 if not OpenDialog1.Execute then exit;
 FillChar(ShExecInfo, sizeof(ShExecInfo), #0);
ShExecInfo.cbSize := sizeof(SHELLEXECUTEINFO);
ShExecInfo.fMask := SEE_MASK_INVOKEIDLIST;
ShExecInfo.Wnd := Application.Handle;
ShExecInfo.lpVerb := 'properties';
ShExecInfo.lpFile := PAnsiChar(OpenDialog1.FileName);
ShExecInfo.lpParameters := nil;
ShExecInfo.lpDirectory := nil;
ShExecInfo.nShow := SW_SHOW;
ShExecInfo.hInstApp := 0;
ShellExecuteEx(@ShExecInfo);
end;
原來 c 的語法:

代碼: 選擇全部

void ShowFileProperties(HWND hwnd, LPSTR lpszFile)
{
SHELLEXECUTEINFO ShExecInfo = {0};

ShExecInfo.cbSize = sizeof(SHELLEXECUTEINFO);
ShExecInfo.fMask = SEE_MASK_INVOKEIDLIST ;
ShExecInfo.hwnd = hwnd;
ShExecInfo.lpVerb = "properties";
ShExecInfo.lpFile = lpszFile;
ShExecInfo.lpParameters = "";
ShExecInfo.lpDirectory = NULL;
ShExecInfo.nShow = SW_SHOW;
ShExecInfo.hInstApp = NULL;
ShellExecuteEx(&ShExecInfo);
}
多多留言, 整理文章, 把經驗累積下來.....
回覆文章