Jump to content
Andrea Raimondi

Opening a document in FMX without custom code

Recommended Posts

Hi!

 

I know the code from Jim to open URLs, for example, but I am more looking for something like ShellExecute on Windows but cross platform.

Any ideas?

 

Thanks!

Share this post


Link to post

There is no cross-platform way to open a path/url.  Every platform has different requirements, so you need platform-specific coding.

  • Like 1

Share this post


Link to post

There are many ways, lots of different nuances on exactly how you want to execute something on the different platforms.

 

Having said that. the following is probably close to what you are asking for:


class procedure TShell.Open(sCommand: string);
begin
{$IFDEF MSWINDOWS}
  ShellExecute(0, 'OPEN', PChar(sCommand), '', '', SW_SHOWNORMAL);
{$ENDIF MSWINDOWS}
{$IFDEF POSIX}
  _system(PAnsiChar('open ' + AnsiString(sCommand)));
{$ENDIF POSIX}
end;

 

Share this post


Link to post

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×