|
web
newsgroups
|
|||||||||||||||||||||||
|
|||||||||||||||||||||||
Dropping folder on desk top iconNormally 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 .... )) al jones <alfredmjo***@shotmail.com> wrote:
>A fellow who uses my 'toy' asked if would be possible to drop a folder of When the windows shell has items dropped on an executable (or shortcut>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?? to an executable), then it launches the executable and passes the names of those items as command-line arguments. So: Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load For Each fn As String In My.Application.CommandLineArgs TextBox1.AppendText(fn & vbCrLf) Next End Sub -- Lucian On Wed, 29 Nov 2006 19:51:36 -0800, Lucian Wischik wrote:
Show quoteHide quote > al jones <alfredmjo***@shotmail.com> wrote: Ah, okay, thanks. That prompts "what happens to any command line switched>>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(ByVal sender As System.Object, ByVal e As > System.EventArgs) Handles MyBase.Load > For Each fn As String In My.Application.CommandLineArgs > TextBox1.AppendText(fn & vbCrLf) > Next > End Sub that I might already have set", but I can deal with that. Thank you sir //al On Wed, 29 Nov 2006 19:51:36 -0800, Lucian Wischik wrote:
Show quoteHide quote > al jones <alfredmjo***@shotmail.com> wrote: Okay, Lucian, you got me into this.... :) >>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(ByVal sender As System.Object, ByVal e As > System.EventArgs) Handles MyBase.Load > For Each fn As String In My.Application.CommandLineArgs > TextBox1.AppendText(fn & vbCrLf) > Next > End Sub 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
Show quote
Hide quote
"al jones" <alfredmjo***@shotmail.com> wrote in message 1.) Before loading your form, in the apps Main method, parse all of your news:1lwte88yjzjsn$.eygq4tgtm4gz.dlg@40tude.net... > On Wed, 29 Nov 2006 19:51:36 -0800, Lucian Wischik wrote: > >> al jones <alfredmjo***@shotmail.com> wrote: >>>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(ByVal sender As System.Object, ByVal e As >> System.EventArgs) Handles MyBase.Load >> For Each fn As String In My.Application.CommandLineArgs >> TextBox1.AppendText(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 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 On Thu, 30 Nov 2006 10:43:44 -0800, Mythran wrote:
Show quoteHide quote > "al jones" <alfredmjo***@shotmail.com> wrote in message Thanks Mythran for the step by step; now to go and see if I understand what> news:1lwte88yjzjsn$.eygq4tgtm4gz.dlg@40tude.net... >> On Wed, 29 Nov 2006 19:51:36 -0800, Lucian Wischik wrote: >> >>> al jones <alfredmjo***@shotmail.com> wrote: >>>>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(ByVal sender As System.Object, ByVal e As >>> System.EventArgs) Handles MyBase.Load >>> For Each fn As String In My.Application.CommandLineArgs >>> TextBox1.AppendText(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 > > I think you said. //al
VB vs. C# language challenge question
Full Screen connect vb app to sql 2005 express how to make cookies into an array? Looking for a simple explanation of how to walk through a dataset in .net 2.0 edit text in file using streamreader and string.replace Can't Figure Out why this array is out of bounds now! Delete Selected Lines from Text File loading treeview dynamically is very slow Add a META line to an existing HTML doc programmatically |
|||||||||||||||||||||||