473,395 Members | 2,253 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,395 software developers and data experts.

Drag file onto my apps icon

Hi,

Does anyone know how I would be able to drag a single file onto my
applications icon and have it run some predefined code.

What I want is to drop an .mp3 file onto my applications icon (not the apps
form) and perform the necessary actions then give a confirmation when these
actions are done then quit.
Any ideas?
Cheers,
Paul
Jul 17 '05 #1
8 3981
See Command function in help. When you drop a file on your app's icon, your
app will start & Command will hold the filename. So in the form's load
event, you can

FileName = Command
'do whatever

"Paul" <12**************@btinternet.com> wrote in message
news:bj**********@sparta.btinternet.com...
Hi,

Does anyone know how I would be able to drag a single file onto my
applications icon and have it run some predefined code.

What I want is to drop an .mp3 file onto my applications icon (not the apps form) and perform the necessary actions then give a confirmation when these actions are done then quit.
Any ideas?
Cheers,
Paul

Jul 17 '05 #2
What about if I wanted to drag some text from a web page onto my form Icon
and then process the text.

k_zeon

"Norm Cook" <no******@cableone.net> wrote in message
news:vl************@corp.supernews.com...
See Command function in help. When you drop a file on your app's icon, your app will start & Command will hold the filename. So in the form's load
event, you can

FileName = Command
'do whatever

"Paul" <12**************@btinternet.com> wrote in message
news:bj**********@sparta.btinternet.com...
Hi,

Does anyone know how I would be able to drag a single file onto my
applications icon and have it run some predefined code.

What I want is to drop an .mp3 file onto my applications icon (not the

apps
form) and perform the necessary actions then give a confirmation when

these
actions are done then quit.
Any ideas?
Cheers,
Paul


---
Outgoing mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.515 / Virus Database: 313 - Release Date: 01/09/2003
Jul 17 '05 #3
"k_zeon" <k_****@hotmail.com> wrote
What about if I wanted to drag some text from a web page onto my form Icon
and then process the text.


Do you see any application that can do that?

LFS
Jul 17 '05 #4
Thanks Norm

"Norm Cook" <no******@cableone.net> wrote in message
news:vl************@corp.supernews.com...
See Command function in help. When you drop a file on your app's icon, your app will start & Command will hold the filename. So in the form's load
event, you can

FileName = Command
'do whatever

"Paul" <12**************@btinternet.com> wrote in message
news:bj**********@sparta.btinternet.com...
Hi,

Does anyone know how I would be able to drag a single file onto my
applications icon and have it run some predefined code.

What I want is to drop an .mp3 file onto my applications icon (not the

apps
form) and perform the necessary actions then give a confirmation when

these
actions are done then quit.
Any ideas?
Cheers,
Paul


Jul 17 '05 #5
When I assign Command to FileName I get, for example, "C:\Program
Files\MyApp\FileToDrop.txt"

I already know how to remove the quotation marks from the string but is
there any way of splitting the path and the filename and assigning them to a
different string?

e.g

FileName = "FileToDrop.txt"
Path = "C:\Program Files\MyApp\"

Thanks
Paul

"Norm Cook" <no******@cableone.net> wrote in message
news:vl************@corp.supernews.com...
See Command function in help. When you drop a file on your app's icon, your app will start & Command will hold the filename. So in the form's load
event, you can

FileName = Command
'do whatever

"Paul" <12**************@btinternet.com> wrote in message
news:bj**********@sparta.btinternet.com...
Hi,

Does anyone know how I would be able to drag a single file onto my
applications icon and have it run some predefined code.

What I want is to drop an .mp3 file onto my applications icon (not the

apps
form) and perform the necessary actions then give a confirmation when

these
actions are done then quit.
Any ideas?
Cheers,
Paul


Jul 17 '05 #6
Paul,
You might try the SPLIT command. Dim a variant to recieve the values and
then address it as a zero-based array.

Dim vPathData as Variant
vPathData = Split(Path,"\")

At this point you have:
vPathData(0) = "C:"
vPathData(1) = "Program Files"
vPathData(2) = "MyApp"
etc....

Hope this helps,
Jim
"Paul" <12**************@btinternet.com> wrote in message
news:bj**********@hercules.btinternet.com...
When I assign Command to FileName I get, for example, "C:\Program
Files\MyApp\FileToDrop.txt"

I already know how to remove the quotation marks from the string but is
there any way of splitting the path and the filename and assigning them to a different string?

e.g

FileName = "FileToDrop.txt"
Path = "C:\Program Files\MyApp\"

Thanks
Paul

"Norm Cook" <no******@cableone.net> wrote in message
news:vl************@corp.supernews.com...
See Command function in help. When you drop a file on your app's icon,

your
app will start & Command will hold the filename. So in the form's load
event, you can

FileName = Command
'do whatever

"Paul" <12**************@btinternet.com> wrote in message
news:bj**********@sparta.btinternet.com...
Hi,

Does anyone know how I would be able to drag a single file onto my
applications icon and have it run some predefined code.

What I want is to drop an .mp3 file onto my applications icon (not the

apps
form) and perform the necessary actions then give a confirmation when

these
actions are done then quit.
Any ideas?
Cheers,
Paul



Jul 17 '05 #7
I always use the following function for this. You could use it as is
or just pull out the bits useful for your app.

Regards,
Andrew
' Written by: Office Developer Edition Code Librarian
' Revised by:
' Purpose: Takes a file path and returns either the path, file,
drive or
' file extension portion depending on which constant was
passed in
' Dependencies:
' Comments:

' Error constants
Public Const ERR_SUBSCRIPT As Long = 9

' Enumeration constants
Public Enum opgParsePath
FILE_ONLY
PATH_ONLY
DRIVE_ONLY
FILEEXT_ONLY
End Enum

Public Function ParsePath(strPath As String, lngPart As opgParsePath)
As String

Dim lngPos As Long
Dim strPart As String
Dim blnIncludesFile As Boolean

' Check that this is a file path. Find the last path separator.
lngPos = InStrRev(strPath, "\")
' Determine whether portion of string after last backslash contains
a period
blnIncludesFile = InStrRev(strPath, ".") > lngPos

If lngPos > 0 Then
Select Case lngPart
' Return file name.
Case opgParsePath.FILE_ONLY
If blnIncludesFile Then
strPart = Right$(strPath, Len(strPath) - lngPos)
Else
strPart = ""
End If
' Return path.
Case opgParsePath.PATH_ONLY
If blnIncludesFile Then
strPart = Left$(strPath, lngPos)
Else
strPart = strPath
End If
' Return drive.
Case opgParsePath.DRIVE_ONLY
strPart = Left$(strPath, 3)
' Return file extension.
Case opgParsePath.FILEEXT_ONLY
If blnIncludesFile Then
' Take three characters after period.
strPart = Mid(strPath, InStrRev(strPath, ".") + 1,
3)
Else
strPart = ""
End If
Case Else
strPart = ""
End Select
End If
ParsePath = strPart

ParsePath_End:
Exit Function

End Function


"Paul" <12**************@btinternet.com> wrote in message news:<bj**********@hercules.btinternet.com>...
When I assign Command to FileName I get, for example, "C:\Program
Files\MyApp\FileToDrop.txt"

I already know how to remove the quotation marks from the string but is
there any way of splitting the path and the filename and assigning them to a
different string?

e.g

FileName = "FileToDrop.txt"
Path = "C:\Program Files\MyApp\"

Thanks
Paul

"Norm Cook" <no******@cableone.net> wrote in message
news:vl************@corp.supernews.com...
See Command function in help. When you drop a file on your app's icon,

your
app will start & Command will hold the filename. So in the form's load
event, you can

FileName = Command
'do whatever

"Paul" <12**************@btinternet.com> wrote in message
news:bj**********@sparta.btinternet.com...
Hi,

Does anyone know how I would be able to drag a single file onto my
applications icon and have it run some predefined code.

What I want is to drop an .mp3 file onto my applications icon (not the apps form) and perform the necessary actions then give a confirmation when these actions are done then quit.
Any ideas?
Cheers,
Paul


Jul 17 '05 #8
> When I assign Command to FileName I get, for example, "C:\Program
Files\MyApp\FileToDrop.txt"

I already know how to remove the quotation marks from the string but is
there any way of splitting the path and the filename and assigning them to a different string?

e.g

FileName = "FileToDrop.txt"
Path = "C:\Program Files\MyApp\"


StringToParse = "C:\Program Files\MyApp\FileToDrop.txt"

LastSlash = InStrRev(StringToParse, "\")
If LastSlash Then
FileName = Mid$(StringToParse, LastSlash + 1)
Path = Left$(StringToParse, LastSlash)
Else
Colon = InStr(StringToParse, ":")
FileName = Mid$(StringToParse, Colon + 1)
Path = Left$(StringToParse, Colon)
End If

Rick - MVP
Jul 17 '05 #9

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

Similar topics

0
by: Mark Sisson | last post by:
Hi gurus. I created a CustomControl starting from a c# Web Control Library Project. I immediately compiled it in Release mode without touching a line of code. Next, I went to another instance of...
5
by: Clyde | last post by:
I am trying to implement the user feedback provided by Windows Explorer when draggng a filename from one place to another. I have the drag and drop action worked out but have had no luck in...
0
by: Yavuz Bogazci | last post by:
Hi, i have build a form with a listbox and the function that he user can drag and drop files from the windows explorer in this listbox. this works for me when i start it on my localmachine. ...
2
by: Pete Mitchell | last post by:
I have an application that parses a file and creates a new one based on the contents of the original file. What do I need to do so that a user could drag the source file from Windows Explorer and...
9
by: Mark | last post by:
hi... i have a program that opens a couple files and performs some operations on them. i wanted to modify my program so that if you drag and drop a file onto the exe via windows, it will open...
1
by: Darren | last post by:
I'm trying to create a file using drag and drop. I want to be able to select a listview item drag it to the shell and create a file. Each icon in the listview represents a blob in a database. When...
1
by: Staal | last post by:
My C# application supports drag and drop of files, folders, shortcuts and links from other applications into mine. This all works pretty nicely, except that I am trying to get a little more...
5
by: =?Utf-8?B?Um9i?= | last post by:
Hi all, I want to fire the drag events when someone drags a file over the application's icon. This means the application has not opened yet. Scenario would be: 1. user selects file they want...
3
by: John | last post by:
Howdy, I havn't been using VB.NET just a whole lot, and am finally making the transistion from VB6 to dotnet. (Yeah it is pretty sad, I know.) Anyhow, I have created several apps in vb6 that...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
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
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
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,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
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,...

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.