473,465 Members | 1,816 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

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 .... ))
Nov 30 '06 #1
5 1283
al jones <al**********@shotmail.comwrote:
>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

--
Lucian
Nov 30 '06 #2
On Wed, 29 Nov 2006 19:51:36 -0800, Lucian Wischik wrote:
al jones <al**********@shotmail.comwrote:
>>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
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
Nov 30 '06 #3
On Wed, 29 Nov 2006 19:51:36 -0800, Lucian Wischik wrote:
al jones <al**********@shotmail.comwrote:
>>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
Nov 30 '06 #4


"al jones" <al**********@shotmail.comwrote in message
news:1l*****************************@40tude.net...
On Wed, 29 Nov 2006 19:51:36 -0800, Lucian Wischik wrote:
>al jones <al**********@shotmail.comwrote:
>>>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


Nov 30 '06 #5
On Thu, 30 Nov 2006 10:43:44 -0800, Mythran wrote:
"al jones" <al**********@shotmail.comwrote in message
news:1l*****************************@40tude.net...
>On Wed, 29 Nov 2006 19:51:36 -0800, Lucian Wischik wrote:
>>al jones <al**********@shotmail.comwrote:
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

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

//al
Nov 30 '06 #6

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
by: jhorner | last post by:
I am writing a c# app and need the ability to drag a file onto the icon - this should then run the app and do something with the file. I made the assumption that doing so would call the app with...
4
by: yxq | last post by:
Hello I found a icon Class, i have tested the code, it can get file and drive icons, but not folder icons, How to get a folder icon? Thanks...
16
by: Phil Hey | last post by:
Hi, I can change the icon for a folder by right clicking on it > going to the customize tab > and selecting Choose Picture. Does anyone know if it is possible to do this programmatically...
3
by: cj | last post by:
I found a good tutorial for making a windows setup program so I'm doing that. But when I add folders to the target machine list they don't seem to have one for the all users startup folder. I...
1
by: Jet Jaguar | last post by:
I'm trying to find a way to set a custom folder icon in OS X. I thought that Applescript would be able to do it, but apparently it can't. Is there anything in the Macintosh libraries of Python...
4
by: mikkoO8 | last post by:
hi. im actually making a desktop cleaner that can move the files and icons to a folder inside the listview box. i can make the listview box filled with files contains at the desktop and i can make...
14
by: Ashutosh Bhawasinka | last post by:
Hi, How can I retrieve the system icon associated with a file/folder so that I can show it in the list view adjacent to the file/folder name? Regards, Ashutosh Bhawasinka
2
HillComanchy
by: HillComanchy | last post by:
I have an old blackberry 8700c, I want to create a home screen icon that takes me directly to the SMS Inbox folder, or to a specific folder from my exchange mailbox, how do I do that? I found out...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
1
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
0
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.