In Windows 11, when I try to double-click a .pptx file, I will see the following "Open with" dialog:
This is a little different from the standard "Open with" dialog, as it has included PowerPoint as the candidate.
I try to simulate such an action via ShellExecute in Delphi, as below:
Value := ShellExecute(Handle, 'openas', PChar(txtFile.Text), nil, nil, SW_SHOWNORMAL);
if (Value <= 32) then
MessageDlg(Format('openas Error code %d', [Value]), mtError, [mbOK], 0);
Value := ShellExecute(Handle, nil, PChar(txtFile.Text), nil, nil, SW_SHOWNORMAL);
if (Value <= 32) then
MessageDlg(Format('nil Error code %d', [Value]), mtError, [mbOK], 0);
Value := ShellExecute(Handle, 'open', PChar(txtFile.Text), nil, nil, SW_SHOWNORMAL);
if (Value <= 32) then
MessageDlg(Format('open Error code %d', [Value]), mtError, [mbOK], 0);
I try 'openas', 'open', nil as the verb, but all of them fail and return error code 31.