473,779 Members | 2,016 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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 3993
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.c om> wrote in message
news:bj******** **@sparta.btint ernet.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******@cable one.net> wrote in message
news:vl******** ****@corp.super news.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.c om> wrote in message
news:bj******** **@sparta.btint ernet.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******@cable one.net> wrote in message
news:vl******** ****@corp.super news.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.c om> wrote in message
news:bj******** **@sparta.btint ernet.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\Fil eToDrop.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******@cable one.net> wrote in message
news:vl******** ****@corp.super news.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.c om> wrote in message
news:bj******** **@sparta.btint ernet.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.c om> wrote in message
news:bj******** **@hercules.bti nternet.com...
When I assign Command to FileName I get, for example, "C:\Program
Files\MyApp\Fil eToDrop.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******@cable one.net> wrote in message
news:vl******** ****@corp.super news.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.c om> wrote in message
news:bj******** **@sparta.btint ernet.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(strPa th 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(strPat h, "\")
' Determine whether portion of string after last backslash contains
a period
blnIncludesFile = InStrRev(strPat h, ".") > lngPos

If lngPos > 0 Then
Select Case lngPart
' Return file name.
Case opgParsePath.FI LE_ONLY
If blnIncludesFile Then
strPart = Right$(strPath, Len(strPath) - lngPos)
Else
strPart = ""
End If
' Return path.
Case opgParsePath.PA TH_ONLY
If blnIncludesFile Then
strPart = Left$(strPath, lngPos)
Else
strPart = strPath
End If
' Return drive.
Case opgParsePath.DR IVE_ONLY
strPart = Left$(strPath, 3)
' Return file extension.
Case opgParsePath.FI LEEXT_ONLY
If blnIncludesFile Then
' Take three characters after period.
strPart = Mid(strPath, InStrRev(strPat h, ".") + 1,
3)
Else
strPart = ""
End If
Case Else
strPart = ""
End Select
End If
ParsePath = strPart

ParsePath_End:
Exit Function

End Function


"Paul" <12************ **@btinternet.c om> wrote in message news:<bj******* ***@hercules.bt internet.com>.. .
When I assign Command to FileName I get, for example, "C:\Program
Files\MyApp\Fil eToDrop.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******@cable one.net> wrote in message
news:vl******** ****@corp.super news.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.c om> wrote in message
news:bj******** **@sparta.btint ernet.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\Fil eToDrop.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\Fil eToDrop.txt"

LastSlash = InStrRev(String ToParse, "\")
If LastSlash Then
FileName = Mid$(StringToPa rse, LastSlash + 1)
Path = Left$(StringToP arse, LastSlash)
Else
Colon = InStr(StringToP arse, ":")
FileName = Mid$(StringToPa rse, Colon + 1)
Path = Left$(StringToP arse, 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
1473
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 VS.NET where I have a web page up in design mode. I went to the Toolbox, selected CustomizeToolbox, and browsed to add my new WebControlLibrary1.dll. The default cog icon showed up for my WebCustomControl1 but then when I went to drag it onto...
5
4969
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 finding how to capture the piece of the screen into a bitmap to simulate the movement. I know this could be done with the Windows API but can't find any way to do it with .Net functions. Any help is appreciated.
0
2866
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. But when i put my Apps .exe file on my WebServers WWWROOT directory and call it from the internet explorer. the application starts with the following error message.
2
2543
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 drop it onto a desktop shortcut icon of my .exe and have it execute ? Thanks in advance.. Pete
9
3562
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 this file and use it instead. however, without even modifying my code first, if i drag and drop a file onto the exe it no longer opens/writes to the files specified by the program. but when no file is dragged onto it, it runs fine as
1
4715
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 I drop onto the shell I want a file created with a specified name containing the data from the database. I've looked at the FileDrop format but it look to have only the filename and not the data. TIA
1
3279
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 information when a web link is dropped onto my application from Internet Explorer. When you drag the link in the Address bar of Internet Explorer to your desktop, the desktop shortcut that gets created has the Title of the web page as it’s name,...
5
5710
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 to open through the app 2. user drags file onto the app's icon (desktop) or from "Send To" popup 3. app opens upon "drop" 4. app recognized the file that was dropped on it and opens the file from
3
1983
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 I allowed the user to drag and drop a file onto the executable. The executable would grab the path and filename of the dropped file and store it in a variable. I could then use the variable to access and manipulate the file. I also used the...
0
9636
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9474
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10306
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
1
10074
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 Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
9930
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
6724
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5373
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 last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
5503
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4037
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 we have to send another system

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.