PC Review


Reply
Thread Tools Rate Thread

Command Line Args

 
 
paul
Guest
Posts: n/a
 
      11th Dec 2003
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\command

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
 
Reply With Quote
 
 
 
 
Blumidoo
Guest
Posts: n/a
 
      11th Dec 2003
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" <(E-Mail Removed)> wrote in message
news:036c01c3c038$d135ee60$(E-Mail Removed)...
> 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\command
>
> 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



 
Reply With Quote
 
Phill. W
Guest
Posts: n/a
 
      12th Dec 2003
"paul" <(E-Mail Removed)> wrote in message
news:036c01c3c038$d135ee60$(E-Mail Removed)...
> 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.


 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Command (line args) =?Utf-8?B?U2ViaG8=?= Microsoft Dot NET Compact Framework 2 21st Oct 2006 11:30 PM
Compactframework : command line args =?Utf-8?B?U2ViaG8=?= Microsoft Dot NET Framework 0 4th Aug 2006 10:36 AM
WinForms and Command Line Args Robert Brinson Microsoft VB .NET 3 23rd Jan 2004 06:51 PM
What are all of the vs7jit command line args? Ken Varn Microsoft Dot NET 0 14th Jan 2004 07:35 PM
Command Line Args Eric Microsoft VC .NET 1 25th Sep 2003 11:20 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 04:52 PM.