Announcement

Collapse
No announcement yet.

parse file name when doubleclicking in explorer.

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • parse file name when doubleclicking in explorer.

    I'd like to be able to parse a filename to my application, when
    the user doubleclicks on the associated filename. It's not a problem
    to get an association, but where does windows put the file name.
    Search on this forum did not reveal anything.
    My app opens with the com32dlg, is there some kind of
    shell-parse-buffer which I can call in the com32dlg ?
    Is it DDE or so? I'm puzzled,

    Anyone ??

    Herman.



    ------------------
    You gotta run, and don't loop back.

  • #2
    Herman, I've read and reread your message several times, and I'm still not sure what you are asking...

    It sounds like you are looking for the COMMAND$ system variable, where the "command-line" parameters are passed to your application.

    If my understanding of your question is wrong, maybe you can rephrase your question more clearly? Thanks!


    ------------------
    Lance
    PowerBASIC Support
    mailto:[email protected][email protected]</A>
    Lance
    mailto:[email protected]

    Comment


    • #3
      Lance, sorry, :rolleyes, maybe i should try to sketch it. I've written a
      a little tool, a dbf file viewer. When you run the program, it gives
      the com32dlg file open dialog. you can pick a .dbf file and it shows
      a view of the fields and records. What I want now is that I associate
      (register) the .dbf file with my app, so that whenever I
      double-click on a .dbf within the explorer, it opens my tool with
      the file I double-clicked. I did not know (expected) that command$
      is available in the dll compiler, but it is. Where does windows put the
      filename when it is doubleclicked in the explorer, or how can it
      be retrieved. I hope I'm clear enough now. :confused

      Herman.



      ------------------
      You gotta run, and don't loop back.

      Comment


      • #4
        When a file is double-clicked (or right-click ; OPEN, etc) the target file name is passed to the "Associated application" as a command-line parameter, therefore COMMAND$ is what you need, regardless of the PowerBASIC compiler you are using.

        In some O/S's such as Windows 2000, the default setting is for Windows to pass the filename enclosed in double quotes, so your code should check for and remove these with:

        a$ = TRIM$(COMMAND$, CHR$(34))

        Once a file association is set up, you can disable quoted command-line parameter behavior through the Windows "file types" setting (Usually in the VIEW|OPTIONS or TOOLS|OPTIONS menu item in Explorer, depending on the O/S version)... for example, the OPEN method would show "%1" and you can edit out the quotes to become simply %1. You'll also find these settings in the Registry.

        I hope this helps!

        ------------------
        Lance
        PowerBASIC Support
        mailto:[email protected][email protected]</A>
        Lance
        mailto:[email protected]

        Comment


        • #5
          Thanks Lance, so you see the need to have look in documentations.
          Did not expect a command$ in a windows compiler, as is it not command-started,
          but event-driven.

          Herman.



          ------------------
          You gotta run, and don't loop back.

          Comment

          Working...
          X