轉為 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;
代碼: 選擇全部
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);
}