469,282 Members | 1,965 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,282 developers. It's quick & easy.

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 3795
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 discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

5 posts views Thread by Clyde | last post: by
reply views Thread by Yavuz Bogazci | last post: by
2 posts views Thread by Pete Mitchell | last post: by
9 posts views Thread by Mark | last post: by
1 post views Thread by Darren | last post: by
5 posts views Thread by =?Utf-8?B?Um9i?= | last post: by
3 posts views Thread by John | last post: by
1 post views Thread by CARIGAR | last post: by
reply views Thread by zhoujie | last post: by
reply views Thread by suresh191 | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.