On Wed, 10 Dec 2003 03:07:48 -0800, Paul wrote:
> Brian,
> Thank you for your example. You previously posted the file
> names would be passed as a parameter (...when you drop a
> file on an icon windows will start the application passing
> the path to the dropped file as a parameter.) so I was
> asking what parameter that would be. It looks like the
> dropped path/file names are put into s by the Dim s As
> String = Command$() line. So I'll research Command$().
> Thanks for pointing me in the right direction.
> Paul
>
>>-----Original Message-----
>>What do you mean what parameter?
>>
>>It's not really that difficult, take a look at command$
>>
>>try the following code:
>>
>> Sub Main()
>> Dim s As String = Command$()
>> Console.WriteLine(s)
>> Console.ReadLine()
>> End Sub
>>
>>Drop 1 to N files on the compiled .EXE, you will find
> something like this:
>>
>>The file names will be quoted and space delimited.
>>
>>
>>Regards
>>Brian W
>>
>>
>><(E-Mail Removed)> wrote in message
>>news:019a01c3be94$05ba0460$(E-Mail Removed)...
>>> Yes, I figured it would launch the program and execute the
>>> code I have in Sub Main. The question is, what parameter
>>> contains the path/name of the file? I'm assuming it would
>>> /could be an array of path names because a person can
>>> select several files and drop them on at once - or
>>> possibly a folder of files.
>>>
>>> In this specific case, I don't even need to open a form -
>>> Just read the dropped file, reformat the data a bit and
>>> write it back out to the same location (path) with the same
>>> name and a different extension. If mulitple files are
>>> dropped I could create an output file for each or combine
>>> the data in all of them to one output file.
>>>
>>> So - what parameter do I look at?
>>> Thanks,
>>>
>>> Paul
>>> >-----Original Message-----
>>> >IIRC, when you drop a file on an icon windows will start
>>> the application
>>> >passing the path to the dropped file as a parameter.
>>> >
>>> >
>>> >HTH
>>> >Brian W
>>> >
>>> >
>>> >
>>> >"Paul" <(E-Mail Removed)> wrote in
> message
>>> >news:036101c3be85$099a2290$(E-Mail Removed)...
>>> >> I have looked and looked for this info. All the I/O
>>> >> examples I've found either explicity use a file name
> or use
>>> >> the OpenFileDialog. When you drag a MS Word document over
>>> >> MS Word, it launches and opens the document. I would like
>>> >> my App to launch and open a document (if it has the
> correct
>>> >> extension). What is the launch event sequence and
> where do
>>> >> I pick up the path/name of the file or files that were
>>> >> dropped on the application icon?
>>> >>
>>> >> Any advice or link to info about this is appreciated.
>>> >>
>>> >> Thanks.
>>> >>
>>> >> Paul
>>> >
>>> >
>>> >.
>>> >
>>
>>
>>.
>>
You can also declare you sub main thusly:
Sub Main(sArgs() As String)
End Sub
The the sArgs array would contain all the command line parameters.
Also look as Environment.CommandLine
--
Chris
To send me an E-mail, remove the underscores and lunchmeat from my E-Mail
address.
|