send to vb .net

okoenning

New member
Joined
Dec 13, 2005
Messages
2
Programming Experience
Beginner
Hello, how can I send a filelist (path + name) to a vb program. I want to use the windows function "send to" from the context menue.Thanks. Oliver
 
Actualy, the Send To is just a folder with some shortcuts in it.
If you look in your user folder under "Documents and Settings" you will see a Send To folder. Any shortcut put in there will then show up in your Send To menu option.

The shortcut will need to be able to send the parameter by having a %1 after the name of the exe. Like this: "C\Program Files\MyProggie\MyProggie.exe" "%1"

Then in your app, you will need to be able to handle command line parameters. I haven't done this in .NET yet, so I'm not sure just how to do that.

-tg
 
Well...if your program is not a service, you could just do:

VB.NET:
Public Sub Main(ByVal args() As String)
    System.Console.WriteLine("Arg1 is " & args(0))
End Sub

But if your program is a service, then presumably it is already running. In which case the program you put on the "Send to" menu would be some other executable that can communicate with the service, possibly via remoting or WMI, for example. Maybe there's also some way to send the service a message via the ServiceController class (not sure if that is possible, but would love to hear how to do it if someone knows. The MSDN docs talk about using ServiceController to send custom messages to the service but give no examples).
 
Don't bother passign arguments through your Main method. Just call Environment.GetCommandLineArgs. It returns a String array with the first element always being the executable path itself. So you just call GetCommandLineArgs and test the Length. If it's greater than 1 then the second argument is the file that has been sent.
 
Back
Top