Follow along with the video below to see how to install our site as a web app on your home screen.
Note: This feature may not be available in some browsers.
uses ShellAPI;
...
procedure PropertiesDialog(filename:String);
var
Info: ShellExecuteInfo;
begin
FillChar(Info, SizeOf(Info), 0);
with Info do
begin
cbSize := SizeOf(Info);
lpFile := PChar(filename);
lpVerb := 'properties';
fMask := SEE_MASK_INVOKEIDLIST;
end;
ShellExecuteEx(@Info);
end;
PropertiesDialog('C:\temp\');
procedure TForm1.Button16Click(Sender: TObject);
function PropertiesDialog(AFilename: String): Cardinal;
var
Info: ShellExecuteInfo;
hDialog: hWnd;
begin
FillChar(Info, SizeOf(Info), 0);
with Info do
begin
cbSize := SizeOf(Info);
lpFile := PChar(AFilename);
lpVerb := 'properties';
fMask := SEE_MASK_INVOKEIDLIST;
end;
ShellExecuteEx(@Info);
Result := Info.hProcess;
end;
function GetFolderName(AFilename: String): String;
var
lastBackSlashPos: Integer;
secondFromLastBSPos: Integer;
counter: Integer;
filename: String;
begin
lastBackSlashPos := 0;
filename := ExcludeTrailingBackslash(AFilename);
for counter := Length(filename) downto 1 do
if filename[counter] = '\' then
begin
lastBackSlashPos := counter;
Break;
end;
Result := Copy(filename, lastBackSlashPos + 1, Length(filename) - lastBackSlashPos);
end;
procedure SetCurSel(AParentHandle, AChildHandle: hWND; AValue: integer);
var
Msg: TMessage;
NM: TNMHdr;
begin
NM.hwndFrom := AChildHandle;
NM.idFrom := AParentHandle;
NM.code := TCN_SELCHANGING;
Msg.Msg := WM_NOTIFY;
Msg.WParam := AParentHandle;
Msg.LParam := integer(@NM);
Dispatch(Msg);
SendMessage(AChildHandle,TCM_SETCURSEL,AValue,0);
NM.code := TCN_SELCHANGE;
Dispatch(Msg);
end;
var
OpenDialog: TOpenDialog;
DialogName: String;
hDialog: hWnd;
hTabControl: hWnd;
hProcess: Cardinal;
begin
OpenDialog := TOpenDialog.Create(nil);
try
if OpenDialog.Execute then
begin
hProcess := PropertiesDialog(ExtractFileDir(OpenDialog.FileName));
Sleep(5000);
//WaitForInputIdle(hProcess, INFINITE);
DialogName := GetFolderName(ExtractFileDir(OpenDialog.Filename)) + ' Properties';
hDialog := FindWindow('#32770', PChar(DialogName));
if hDialog > 0 then
begin
hTabControl := FindWindowEx(hDialog, 0, 'SysTabControl32', nil);
if hTabControl > 0 then
SetCurSel(hDialog, hTabControl, 1);
end;
end;
finally
OpenDialog.Free;
end;
end;
hDialog := FindWindow('#32770', PChar(DialogName));
if hDialog > 0 then
begin
hGeneral := FindWindowEx(hDialog, 0, '#32770', nil);
if hGeneral > 0 then
begin
hCheckBox := FindWindowEx(hGeneral, 0, 'Button', '&Read-only');
if hCheckBox > 0 then
SendMessage(hCheckBox, BM_SETCHECK, BST_CHECKED, 0);
end;
end;