Re: Command line interface and Windows form in same program
- From: "Jwe" <jwe@xxxxxxxx>
- Date: Fri, 8 Feb 2008 17:39:48 -0000
If I change the project to a Console Application, the behaviour
is different:
1. Run TheProgram.exe from a command prompt with no arguments:
the Windows form is displayed and the command prompt returns
immediately. This works as expected.
2. Run TheProgram.exe by double-clicking it in Windows Explorer:
the Windows form is display and no console window is opened.
This works as expected.
BUT:
3. Run TheProgram.exe from a command prompt with correct number
of arguments: runs as expected, but does not display the expected
message.
4. Run TheProgram.exe from a command prompt with incorrect number
of arguments: does not display the command help.
Thanks for any tips etc.
"Jwe" <jwe@xxxxxxxx> wrote in message
news:ce2dndMpKcVZ6zHanZ2dneKdnZydnZ2d@xxxxxxxxxxxx
Hi,
I've written a program which has both a command line interface
and Windows form interface, however it isn't quite working
correctly.
When run from command line with no arguments it should display
the Windows form. The form is being displayed but the command
only returns when the form is closed. I want the command line
to return immediately, leaving the form displayed.
When run from Windows Explorer (by double-clicking on
TheProgram.exe) it should display the Windows form only. The
form is being displayed but a console window is also being
displayed.
When run from the command line with the correct number of
arguments it should operate on the supplied arguments and
display a message. This is working correctly.
If the correct number of arguments is supplied it should
display the command help. This is working correctly.
In Project - Properties, the Output type is 'Windows
Application' and Startup object is 'Sub Main'.
Sub Main is basically:
arguments = Environment.GetCommandLineArgs()
If arguments.Length = 1 Then
'No command line arguments so display the Windows
form
Dim frmMain As New frmWindows_Form
Application.Run(frmMain)
ElseIf arguments.Length <> 3 Then
'Required arguments not supplied, so display the
help
Output_Command_Help()
Else
'Run command
Any help much appreciated. Thanks.
.
- References:
- Prev by Date: Re: Command line interface and Windows form in same program
- Next by Date: Re: Command line interface and Windows form in same program
- Previous by thread: Re: Command line interface and Windows form in same program
- Next by thread: Re: Command line interface and Windows form in same program
- Index(es):
Relevant Pages
|