uses CommDlg;
procedure TForm1.Button1Click(Sender: TObject);
var
ofn: TOpenFileName;
szFile: array[0..MAX_PATH] of Char;
Result: string;
begin
FillChar(ofn, SizeOf(TOpenFileName), 0);
with ofn do
begin
lStructSize := SizeOf(TOpenFileName);
hwndOwner := Handle;
lpstrFile := szFile;
nMaxFile := SizeOf(szFile);
lpstrTitle := PChar('AAAA');
lpstrInitialDir := PChar('C:/');
Flags := 4;
end;
if GetOpenFileName(ofn) then
Result := StrPas(ofn.lpstrFile);
end;