[Lazarus] Opening a file with spaces in the filename (again)

Alejandro Gonzalo parkingspace26 at yahoo.com
Wed Mar 6 00:43:19 CET 2013


If you only will be using Windows, you can use:
 
    ShellExecute(HWND(nil),nil,PChar('myFile.pdf'),PChar(''),nil ,1);
 
You will need ShellAPI in the uses clause.
 
A. G.


>________________________________
> From: John <jszcmpr at netspace.net.au>
>To: Lazarus mailing list <lazarus at lists.lazarus.freepascal.org> 
>Sent: Tuesday, March 5, 2013 3:23 PM
>Subject: Re: [Lazarus] Opening a file with spaces in the filename (again)
>  
>On 03/06/2013 04:49 AM, Bart wrote:
>> On 3/5/13, John <jszcmpr at netspace.net.au> wrote:
>> 
>>> I want to open a tiff file using what ever viewer the PC knows about
>>> that can do it (it will be irfanview on the test PC).  It seemed that
>>> "OpenDocument"  is the appropriate method.  This works fine so long as
>>> the path has no spaces, but OpenDocument calls OpenURL, and that
>>> converts the spaces to %20 s
>> In trunk it does not replace spaces with %20.
>> This was reverted in r36934.
>I see this in trunk, but not in release 1.0.6, which purports to be r40xxx ?  I upgraded when I saw the note about the reversion in the bug tracker.  (I usually work from trunk on my development PC, but I am doing this on a separate PC, and wanted to keep the install as simple as possible).
>
>Anyway, I removed the clause that inserts the %20s, it all works fine, so I can leave it at that for now.
>(This, of course, is the joy of open source software!)
>
>However, I can't help thinking that the REAL problem is that probably there were originally an OpenURL and an OpenDocument for a reason.  OpenURL could be optimised for URLs, OpenDocuments for file system documents.  OpenDocument could possibly look for a '://' and pass it off to OpenURL if it found one.
>
>(Sorry, it is hard to keep up a "conversation" from GMT+11)
>
>cheers,
>John Sunderland
>
>--
>_______________________________________________
>Lazarus mailing list
>Lazarus at lists.lazarus.freepascal.org
>http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus
>
>
>   
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.lazarus-ide.org/pipermail/lazarus/attachments/20130305/9e48c2e1/attachment-0003.html>


More information about the Lazarus mailing list