Re: Command line interface and Windows form in same program



Sorry, I see how I confused you. I'm trying to say to switch back to a
winform app, and just lauch it from a command line. WinWord was just an
example. You would launch MyApplication.exe if that is your built
executable. I thought however that System.IO.Console.WriteLine would still
work, but it doesn't seem to in my quick test. Sorry!


"Jwe" wrote:

Hi, thanks for your reply, however I'm not trying to run any
external program like Winword in the way you describe. This is a
single .exe generated by a single VB.Net project. The project
was started as a Windows Application (to get the Form in the
project) and then changed to a console app.

"Family Tree Mike" <FamilyTreeMike@xxxxxxxxxxxxxxxxxxxxxxxxx>
wrote in message
news:815AD2A3-2322-41F6-BB7B-67FE6DDB3A43@xxxxxxxxxxxxxxxx
WinWord.exe, for example, can be started as a command line. I
believe all
you would need to do in this case is to create a winforms
application. If
the user starts it from a command line it should behave as you
expect. Just
include your logic for the argument checks and write to
Console.out.

"Jwe" wrote:

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.






.



Relevant Pages

  • Re: Command line interface and Windows form in same program
    ... I've written a program which has both a command line interface ... and Windows form interface, ... TheProgram.exe) it should display the Windows form only. ... Application' and Startup object is 'Sub Main'. ...
    (microsoft.public.dotnet.languages.vb)
  • Re: Command line interface and Windows form in same program
    ... external program like Winword in the way you describe. ... was started as a Windows Application (to get the Form in the ... I've written a program which has both a command line interface ... TheProgram.exe) it should display the Windows form only. ...
    (microsoft.public.dotnet.languages.vb)
  • Re: Command line interface and Windows form in same program
    ... Run TheProgram.exe from a command prompt with no arguments: ... Run TheProgram.exe by double-clicking it in Windows Explorer: ... the Windows form is display and no console window is opened. ...
    (microsoft.public.dotnet.languages.vb)
  • Command line interface and Windows form in same program
    ... I've written a program which has both a command line interface ... and Windows form interface, ... TheProgram.exe) it should display the Windows form only. ...
    (microsoft.public.dotnet.languages.vb)
  • Re: Display problems in Vista
    ... Very small overhead. ... the command packet needs to be transfered. ... have to display a line that is x pixels wide at any zoom level. ...
    (comp.graphics.api.opengl)

Loading