Delphi

NAVIGATION
CATEGORIES
REFERRENCE
LINKS
  • Help to open multiple files from double click in windows

    5 answers - 1052 bytes - related search similar search Add To My Delicious Add To My Stumble Upon Add To My Google Mark Add To My Facebook Add To My Digg Add To My Reddit

    to have only one application running see
    C (wilfried (AT) mestdagh (DOT) biz, http://www.mestdagh.biz or Google it).
    I don't understand: "when windows wants to open another php file."
    Andre van Zuydam <andre (AT) spiceware (DOT) co.zawrote:
    I'm developing a PHP editor to work specifically with the Firebird database and I have got the
    application to open a php file when I double click on it using StrParam.
    I only want to have one open application at any time and so I need to "know" when windows wants
    to open another php file. How do I do this in Delphi?
    Thanks for any help in advance
    Andre van Zuydam
    Delphi-Talk mailing list -Delphi-Talk (AT) elists (DOT) org
    and the traveler died, stroked by the beauty of the landscape.
    THE MRNING F THE MAGICIANS
    Louis Pawels & Jacques Bergier
    Yahoo! DSL Something to write home about.
    Just $16.99/mo. or less.
    dsl.yahoo.com
    Delphi-Talk mailing list -Delphi-Talk (AT) elists (DOT) org
  • No.1 | | 1930 bytes | |

    Well - it could be any file. In my case its a text file (a php file). My
    programme is open and I want to know when windows wants to open another one
    so I can open it in my programme, it being the default
    editor. I hope this makes sense.

    Message
    From: "Human" <newfedra (AT) yahoo (DOT) com>
    To: "Delphi-Talk Discussion List" <delphi-talk (AT) elists (DOT) org>
    Sent: Tuesday, December 06, 2005 6:03 AM
    Subject: Re: Help to open multiple files from double click in windows

    to have only one application running see
    C (wilfried (AT) mestdagh (DOT) biz, http://www.mestdagh.biz or Google it).

    I don't understand: "when windows wants to open another php file."

    Andre van Zuydam <andre (AT) spiceware (DOT) co.zawrote:
    >
    >I'm developing a PHP editor to work specifically with the Firebird
    >database and I have got the
    >application to open a php file when I double click on it using StrParam.
    >>

    >I only want to have one open application at any time and so I need to
    >"know" when windows wants
    >to open another php file. How do I do this in Delphi?
    >>

    >Thanks for any help in advance
    >>

    >Andre van Zuydam
    >
    >Delphi-Talk mailing list -Delphi-Talk (AT) elists (DOT) org
    >
    >>

    >
    >

    and the traveler died, stroked by the beauty of the landscape.

    THE MRNING F THE MAGICIANS
    Louis Pawels & Jacques Bergier
    >
    >
    >


    Yahoo! DSL - Something to write home about.
    Just $16.99/mo. or less.
    dsl.yahoo.com

    Delphi-Talk mailing list -Delphi-Talk (AT) elists (DOT) org

    Delphi-Talk mailing list -Delphi-Talk (AT) elists (DOT) org
  • No.2 | | 753 bytes | |

    Andre van Zuydam wrote:

    >Well - it could be any file. In my case its a text file (a php file). My
    >programme is open and I want to know when windows wants to open another one
    >so I can open it in my programme, it being the default
    >editor. I hope this makes sense.
    >

    Andre, perhaps you could register the .PHP file extension with Windows
    to be associated with (opened by default by your program) at
    initialization time and return the .PHP association to its original
    state as part of your application's finalization routine.

    Would this achieve the effect you need?

    HTH,
    Malcolm

    Delphi-Talk mailing list -Delphi-Talk (AT) elists (DOT) org
  • No.3 | | 2422 bytes | |

    Malcolm J. Kudra wrote:
    Andre van Zuydam wrote:
    >Well - it could be any file. In my case its a text file (a php file). My
    >programme is open and I want to know when windows wants to open another one
    >so I can open it in my programme, it being the default
    >editor. I hope this makes sense.


    Andre, perhaps you could register the .PHP file extension with Windows
    to be associated with (opened by default by your program) at
    initialization time and return the .PHP association to its original
    state as part of your application's finalization routine.

    Would this achieve the effect you need?

    That's not what he needs. He needs to know how to make his program
    accept multiple files, instead of starting a new instance for each file.

    This is his scenario: His program is already open, perhaps editing a PHP
    file already, or perhaps without any files open. The user opens Explorer
    and double-clicks a PHP file. With the usual file-association rules,
    Windows will start a new instance of the application, passing the file
    name as a command-line parameter. But instead of editing that file in
    the new instance, which is what Andre's program already does, he wants
    to edit that file in the instance that was already open before.

    way to solve this is to change the file-association rules to use DDE
    instead of just a command line. Andre's program can then use Delphi's
    DDE components to accept commands from Windows to open another file.

    The more common way to solve this is to have subsequent instances of the
    program detect that they aren't the first, and instead of continuing
    with their initialization sequence, they simply pass the file name along
    to the already-open instance and terminate. Detecting multiple instances
    is easy, and there are lots of examples in the newsgroup archives. There
    are slightly fewer examples of sending the new instance's command line
    to the old instance. I don't have time to explain it now, but I do it
    this evening if necessary.

    I think hijacking the file association while the program is running is a
    bad idea. But I don't think it would affect anything in this case since
    it sounds like Andre's program is already associated with PHP files, so
    there's nothing to hijack.
  • No.4 | | 3321 bytes | |

    I see, Rob - thanks.

    Would you suggest that Andre implement your approach by using either the
    TJvAppInstances component (from the JVCL) or the STFirst unit (from
    SysTools), both available on SourceForge free of charge?

    can you suggest other existing code that would work better than
    either of these but still allow Andre to re-use rather than re-invent?

    Rob Kennedy wrote:

    >Malcolm J. Kudra wrote:


    >
    >>Andre van Zuydam wrote:

    >
    >>

    Well - it could be any file. In my case its a text file (a php file). My
    programme is open and I want to know when windows wants to open another one
    so I can open it in my programme, it being the default
    editor. I hope this makes sense.


    >>Andre, perhaps you could register the .PHP file extension with Windows
    >>to be associated with (opened by default by your program) at
    >>initialization time and return the .PHP association to its original
    >>state as part of your application's finalization routine.
    >>
    >>Would this achieve the effect you need?

    >
    >>

    >
    >That's not what he needs. He needs to know how to make his program
    >accept multiple files, instead of starting a new instance for each file.
    >
    >This is his scenario: His program is already open, perhaps editing a PHP
    >file already, or perhaps without any files open. The user opens Explorer
    >and double-clicks a PHP file. With the usual file-association rules,
    >Windows will start a new instance of the application, passing the file
    >name as a command-line parameter. But instead of editing that file in
    >the new instance, which is what Andre's program already does, he wants
    >to edit that file in the instance that was already open before.
    >

    way to solve this is to change the file-association rules to use DDE
    >instead of just a command line. Andre's program can then use Delphi's
    >DDE components to accept commands from Windows to open another file.
    >
    >The more common way to solve this is to have subsequent instances of the
    >program detect that they aren't the first, and instead of continuing
    >with their initialization sequence, they simply pass the file name along
    >to the already-open instance and terminate. Detecting multiple instances
    >is easy, and there are lots of examples in the newsgroup archives. There
    >are slightly fewer examples of sending the new instance's command line
    >to the old instance. I don't have time to explain it now, but I do it
    >this evening if necessary.
    >
    >I think hijacking the file association while the program is running is a
    >bad idea. But I don't think it would affect anything in this case since
    >it sounds like Andre's program is already associated with PHP files, so
    >there's nothing to hijack.
    >


    Delphi-Talk mailing list -Delphi-Talk (AT) elists (DOT) org
  • No.5 | | 890 bytes | |

    Malcolm J. Kudra wrote:
    Would you suggest that Andre implement your approach by using either the
    TJvAppInstances component (from the JVCL) or the STFirst unit (from
    SysTools), both available on SourceForge free of charge?

    can you suggest other existing code that would work better than
    either of these but still allow Andre to re-use rather than re-invent?

    I'm not familiar with either of those; the one time I needed something
    like this was long ago, and I just wrote my own thing that used a mutex
    for detecting multiple instances and a thread with a mailslot to listen
    for commands from new instances. , I think it was an elegant
    solution, but I've never gotten around to generalizing it for others to
    use.

    I trust JEDI to get things right, though, so I'd recommend the JVCL
    component.

    http://jvcl.sourceforge.net/

Re: Help to open multiple files from double click in windows


max 4000 letters.
Your nickname that display:
In order to stop the spam: 7 + 6 =
QUESTION ON "Delphi"

EMSDN.COM