473,385 Members | 1,973 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,385 software developers and data experts.

Command Line Args

I have a file type that is going to be associated with my
visual basic application and i want the user to be able
to double click on a file of said type and have it launch
the program and load the file. I know there are certain
keys in the registry that i have to create and/or edit.
I have located them, namely HKEY_CLASSES_ROOT\.stdf and
HKEY_CLASSES_ROOT\stdf_auto_file\shell\open\comman d

The default value for that last key is the path to my
application followed by "%1". I thought that this would
take the file that was double clicked and pass it to my
program but on inspection of the
Environment.GetCommandLineArgs() I found that only the
path to the calling program is getting passed.

Is there a problem with my registry keys or my visual
basic program that needs to be addressed. Any help is
greatly appreciated.
Thanks
-Paul
Nov 20 '05 #1
2 3954
Hello,

You may want to try Microsoft.VisualBasic.Command() function. Here is what
Help file says:

Returns the argument portion of the command line used to launch Visual Basic
or an executable program developed with Visual Basic.

Public Function Command() As String
Remarks
For applications developed with Visual Basic and compiled to an .exe file,
the Command function returns any arguments that appear after the name of the
application on the command line, as in this example:

MyApp cmdlineargs
Example
This example uses the Command function to get the command-line arguments in
a function that returns them in an object containing an array.

Function GetCommandLineArgs() As String()
' Declare variables.
Dim separators As String = " "
Dim commands As String = Microsoft.VisualBasic.Command()
Dim args() As String = commands.Split(separators.ToCharArray)
Return args
End Function

You may add your own filetypes in setup project configuration.
Hope it helps :-)

sincerely,
--
Sebastian Zaklada
Skilled Software
http://www.skilledsoftware.com
************************************
SQL Source Control 2003 - for
SQL Server Source Safe integration
and custom databases documentation

"paul" <an*******@discussions.microsoft.com> wrote in message
news:03****************************@phx.gbl...
I have a file type that is going to be associated with my
visual basic application and i want the user to be able
to double click on a file of said type and have it launch
the program and load the file. I know there are certain
keys in the registry that i have to create and/or edit.
I have located them, namely HKEY_CLASSES_ROOT\.stdf and
HKEY_CLASSES_ROOT\stdf_auto_file\shell\open\comman d

The default value for that last key is the path to my
application followed by "%1". I thought that this would
take the file that was double clicked and pass it to my
program but on inspection of the
Environment.GetCommandLineArgs() I found that only the
path to the calling program is getting passed.

Is there a problem with my registry keys or my visual
basic program that needs to be addressed. Any help is
greatly appreciated.
Thanks
-Paul

Nov 20 '05 #2
"paul" <an*******@discussions.microsoft.com> wrote in message
news:03****************************@phx.gbl...
I have a file type ... to be able to double click on a file of said
type and have it launch the program and load the file.


Code you application to start with a Sub Main that looks like this:

Sub Main( ByVal saArguments() as String )
' Load and Run() main form in here

With the Registry settings you describe, double-clicking on a file
should fire up your program and deliver [the path and name of]
the file into saArguments( 0 ) - all being well.

HTH,
Phill W.
Nov 20 '05 #3

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

Similar topics

9
by: Manlio Perillo | last post by:
Regards. In the standard library there are two modules for command line parsing: optparse and getopt. In the Python Cookbook there is another simple method for parsing, using a docstring. ...
0
by: andrea valle | last post by:
Hi to all, I need to run a program from inside python (substantially, algorithmic batch processing). I'm on mac osx 10.3.8 with python 2.3 framework and macpython. Trying to use exec*, I...
8
by: djc | last post by:
I'm new to this and was wondering what the options are for interpreting the command line using a CLI program. Specifically methods for interpreting the parameters passed to the program on the...
4
by: Milan | last post by:
How do you pass in arguments from the command line to a .Net windows app. Senario: vb.net application should be able to execute from command prompt by passing login and password and should be...
6
by: shana07 | last post by:
Friends, I wish to consult about this big arithmetic program. This program basically is calculating big numbers. It work great from command prompt, for instance: java bigal 99999999999999999 + 5....
11
by: imtiazalikhan | last post by:
hi i am trying to sum 10 numbers passing them by command line line argument but the problem is it only work with 1 and if i passing other numbers then again it will show the result of number1:...
4
by: cjt22 | last post by:
Hi there. I just wondered whether anyone could recommend the correct way I should be passing command line parameters into my program. I am currently using the following code: def main(argv =...
51
by: Ojas | last post by:
Hi!, I just out of curiosity want to know how top detect the client side application under which the script is getting run. I mean to ask the how to know whether the script is running under...
6
by: tvaughan77 | last post by:
Hi, I have some code that I want to use to run a command line utility and I want to be able to run it from an aspx page running under IIS. The command line utility is a local utility running on...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
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...

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.