Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsFree MagazinesWhite PapersSubmit Content
Discussion GroupsASP.NETWindows FormsLanguages.NET FrameworkVisual Studio.NET
Articles.NET FrameworkASP.NETToolsWindows Forms
.NET DirectoryOpen Source ProjectsUser GroupsWeb Resources
Related Topics
Visual Basic 6SQL ServerMS AccessOther DB ProductsMS Server ProductsMore Topics ...

.NET Forum / Languages / VB.NET / November 2006

Tip: Looking for answers? Try searching our database.

Dropping folder on desk top icon

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
al jones - 30 Nov 2006 03:27 GMT
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 - 30 Nov 2006 03:51 GMT
>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

Signature

Lucian

al jones - 30 Nov 2006 04:38 GMT
>>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
[quoted text clipped - 10 lines]
>   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
al jones - 30 Nov 2006 06:06 GMT
>>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
[quoted text clipped - 10 lines]
>   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
Mythran - 30 Nov 2006 18:43 GMT
>>>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
[quoted text clipped - 36 lines]
>
> //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
al jones - 30 Nov 2006 21:33 GMT
>>>>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
[quoted text clipped - 60 lines]
> HTH,
> Mythran

Thanks Mythran for the step by step; now to go and see if I understand what
I think you said.

//al

Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.