Dropping folder on desk top icon

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • al jones

    #1

    Dropping folder on desk top icon

    Normally I have some idea of where in the MSDN to start looking but on this
    one I have absolutely no idea.

    A fellow who uses my 'toy' asked if would be possible to drop a folder of
    files / folders to be processed onto the desktop icon ( well, of course it
    would ;) ) My question is how do I detect that in a vb 2005 program??

    //al

    (( Cor, I'm working of the question .... ))
  • Lucian Wischik

    #2
    Re: Dropping folder on desk top icon

    al jones <alfredmjones@s hotmail.comwrot e:
    >A fellow who uses my 'toy' asked if would be possible to drop a folder of
    >files / folders to be processed onto the desktop icon ( well, of course it
    >would ;) ) My question is how do I detect that in a vb 2005 program??
    When the windows shell has items dropped on an executable (or shortcut
    to an executable), then it launches the executable and passes the
    names of those items as command-line arguments. So:

    Private Sub Form1_Load(ByVa l sender As System.Object, ByVal e As
    System.EventArg s) Handles MyBase.Load
    For Each fn As String In My.Application. CommandLineArgs
    TextBox1.Append Text(fn & vbCrLf)
    Next
    End Sub

    --
    Lucian

    Comment

    • al jones

      #3
      Re: Dropping folder on desk top icon

      On Wed, 29 Nov 2006 19:51:36 -0800, Lucian Wischik wrote:
      al jones <alfredmjones@s hotmail.comwrot e:
      >>A fellow who uses my 'toy' asked if would be possible to drop a folder of
      >>files / folders to be processed onto the desktop icon ( well, of course it
      >>would ;) ) My question is how do I detect that in a vb 2005 program??
      >
      When the windows shell has items dropped on an executable (or shortcut
      to an executable), then it launches the executable and passes the
      names of those items as command-line arguments. So:
      >
      Private Sub Form1_Load(ByVa l sender As System.Object, ByVal e As
      System.EventArg s) Handles MyBase.Load
      For Each fn As String In My.Application. CommandLineArgs
      TextBox1.Append Text(fn & vbCrLf)
      Next
      End Sub
      Ah, okay, thanks. That prompts "what happens to any command line switched
      that I might already have set", but I can deal with that.

      Thank you sir //al

      Comment

      • al jones

        #4
        Re: Dropping folder on desk top icon

        On Wed, 29 Nov 2006 19:51:36 -0800, Lucian Wischik wrote:
        al jones <alfredmjones@s hotmail.comwrot e:
        >>A fellow who uses my 'toy' asked if would be possible to drop a folder of
        >>files / folders to be processed onto the desktop icon ( well, of course it
        >>would ;) ) My question is how do I detect that in a vb 2005 program??
        >
        When the windows shell has items dropped on an executable (or shortcut
        to an executable), then it launches the executable and passes the
        names of those items as command-line arguments. So:
        >
        Private Sub Form1_Load(ByVa l sender As System.Object, ByVal e As
        System.EventArg s) Handles MyBase.Load
        For Each fn As String In My.Application. CommandLineArgs
        TextBox1.Append Text(fn & vbCrLf)
        Next
        End Sub
        Okay, Lucian, you got me into this.... :)
        I was already checking for some command line arguements of my own so making
        this addition was easy - once I knew where to look.

        But now for the dumb logic portion of this - I process the command
        arguments in formload. What I want is to bypass the 'Run' button if they
        drop a folder on the program icon, just take the existing options, use this
        folder and go from there.

        No, not being reasonable (I deleted my first attempt here) I'd like to
        display the form as I do have progress bars, etc on it. But I'd also like
        it set so that they don't have to click on anything - they've already given
        me what I need - so I'd just like to load everything and pretend they
        clicked 'Run'.

        aside: I should probably move the command line processing to a seperate
        function (it's beginning to get to be unwieldly) but I still have to return
        to form load which will expect input .... suggestions???

        //al

        Comment

        • Mythran

          #5
          Re: Dropping folder on desk top icon



          "al jones" <alfredmjones@s hotmail.comwrot e in message
          news:1lwte88yjz jsn$.eygq4tgtm4 gz.dlg@40tude.n et...
          On Wed, 29 Nov 2006 19:51:36 -0800, Lucian Wischik wrote:
          >
          >al jones <alfredmjones@s hotmail.comwrot e:
          >>>A fellow who uses my 'toy' asked if would be possible to drop a folder of
          >>>files / folders to be processed onto the desktop icon ( well, of course
          >>>it
          >>>would ;) ) My question is how do I detect that in a vb 2005 program??
          >>
          >When the windows shell has items dropped on an executable (or shortcut
          >to an executable), then it launches the executable and passes the
          >names of those items as command-line arguments. So:
          >>
          >Private Sub Form1_Load(ByVa l sender As System.Object, ByVal e As
          >System.EventAr gs) Handles MyBase.Load
          > For Each fn As String In My.Application. CommandLineArgs
          > TextBox1.Append Text(fn & vbCrLf)
          > Next
          >End Sub
          >
          Okay, Lucian, you got me into this.... :)
          I was already checking for some command line arguements of my own so
          making
          this addition was easy - once I knew where to look.
          >
          But now for the dumb logic portion of this - I process the command
          arguments in formload. What I want is to bypass the 'Run' button if they
          drop a folder on the program icon, just take the existing options, use
          this
          folder and go from there.
          >
          No, not being reasonable (I deleted my first attempt here) I'd like to
          display the form as I do have progress bars, etc on it. But I'd also like
          it set so that they don't have to click on anything - they've already
          given
          me what I need - so I'd just like to load everything and pretend they
          clicked 'Run'.
          >
          aside: I should probably move the command line processing to a seperate
          function (it's beginning to get to be unwieldly) but I still have to
          return
          to form load which will expect input .... suggestions???
          >
          //al
          1.) Before loading your form, in the apps Main method, parse all of your
          command-line switches (and yes, I would break this out into a separate
          method or even class if it is getting larger).

          2.) Create a new constructor for your form that accepts the argument(s) that
          are passed from the command-line. Initialize any members to these arguments
          if required.

          3.) Instead of having your processing code in the "Start" buttons event
          handler, move this logic into a separate method.

          4.) In your "Start" buttons event handler, call the method created in step
          3.

          5.) In your forms load event handler, check to see if all the required
          values are present via members/properties set in step #2. If they are set,
          call the form's Show method and then call the method created in step 3.

          This should help get ya started to allow drag-n-drop onto the exec as well
          as using the gui to specify required arguments.

          HTH,
          Mythran




          Comment

          • al jones

            #6
            Re: Dropping folder on desk top icon

            On Thu, 30 Nov 2006 10:43:44 -0800, Mythran wrote:
            "al jones" <alfredmjones@s hotmail.comwrot e in message
            news:1lwte88yjz jsn$.eygq4tgtm4 gz.dlg@40tude.n et...
            >On Wed, 29 Nov 2006 19:51:36 -0800, Lucian Wischik wrote:
            >>
            >>al jones <alfredmjones@s hotmail.comwrot e:
            >>>>A fellow who uses my 'toy' asked if would be possible to drop a folder of
            >>>>files / folders to be processed onto the desktop icon ( well, of course
            >>>>it
            >>>>would ;) ) My question is how do I detect that in a vb 2005 program??
            >>>
            >>When the windows shell has items dropped on an executable (or shortcut
            >>to an executable), then it launches the executable and passes the
            >>names of those items as command-line arguments. So:
            >>>
            >>Private Sub Form1_Load(ByVa l sender As System.Object, ByVal e As
            >>System.EventA rgs) Handles MyBase.Load
            >> For Each fn As String In My.Application. CommandLineArgs
            >> TextBox1.Append Text(fn & vbCrLf)
            >> Next
            >>End Sub
            >>
            >Okay, Lucian, you got me into this.... :)
            >I was already checking for some command line arguements of my own so
            >making
            >this addition was easy - once I knew where to look.
            >>
            >But now for the dumb logic portion of this - I process the command
            >arguments in formload. What I want is to bypass the 'Run' button if they
            >drop a folder on the program icon, just take the existing options, use
            >this
            >folder and go from there.
            >>
            >No, not being reasonable (I deleted my first attempt here) I'd like to
            >display the form as I do have progress bars, etc on it. But I'd also like
            >it set so that they don't have to click on anything - they've already
            >given
            >me what I need - so I'd just like to load everything and pretend they
            >clicked 'Run'.
            >>
            >aside: I should probably move the command line processing to a seperate
            >function (it's beginning to get to be unwieldly) but I still have to
            >return
            >to form load which will expect input .... suggestions???
            >>
            >//al
            >
            1.) Before loading your form, in the apps Main method, parse all of your
            command-line switches (and yes, I would break this out into a separate
            method or even class if it is getting larger).
            >
            2.) Create a new constructor for your form that accepts the argument(s) that
            are passed from the command-line. Initialize any members to these arguments
            if required.
            >
            3.) Instead of having your processing code in the "Start" buttons event
            handler, move this logic into a separate method.
            >
            4.) In your "Start" buttons event handler, call the method created in step
            3.
            >
            5.) In your forms load event handler, check to see if all the required
            values are present via members/properties set in step #2. If they are set,
            call the form's Show method and then call the method created in step 3.
            >
            This should help get ya started to allow drag-n-drop onto the exec as well
            as using the gui to specify required arguments.
            >
            HTH,
            Mythran
            >
            >
            Thanks Mythran for the step by step; now to go and see if I understand what
            I think you said.

            //al

            Comment

            Working...