Hey
I have already written a program that has a user interface, but I would like
to add some command line interface too. So if the user run it like:
program.exe paramater1
The program do something, but If not, the program normally run with windows
interface.
I tried Sub Main(args[] ... ) but I don't know how to connect it together.
Jarod 5 2180
Jarod <Ja***@discussi ons.microsoft.c om> wrote: I have already written a program that has a user interface, but I would like to add some command line interface too. So if the user run it like: program.exe paramater1 The program do something, but If not, the program normally run with windows interface. I tried Sub Main(args[] ... ) but I don't know how to connect it together.
Are you writing in C# or VB.NET? This is a C# group, but Sub Main looks
very much like VB.NET...
Writing something with both a command line interface and a windows
interface is relatively tricky, I believe. I suspect there's a way to
write a console application and then have it "disconnect " from the
console if you're running it in Windows mode, but I don't know how
you'd do the disconnection.
To use command line parameters for your Windows app, just change the
signature of Main from
static void Main()
to
static void Main (string[] args)
and work from there.
--
Jon Skeet - <sk***@pobox.co m> http://www.pobox.com/~skeet
If replying to the group, please do not mail me too
> Are you writing in C# or VB.NET? This is a C# group, but Sub Main looks very much like VB.NET...
Yeah it was mistake, because I also use a VB.Net. Writing something with both a command line interface and a windows interface is relatively tricky, I believe. I suspect there's a way to write a console application and then have it "disconnect " from the console if you're running it in Windows mode, but I don't know how you'd do the disconnection.
To use command line parameters for your Windows app, just change the signature of Main from
static void Main()
to
static void Main (string[] args)
and work from there.
But I have something like this:
I wrote a Windows form application, and now I need to add some command line
parameter. The problem is, when I use Main(...) the program executes only the
main, no windows form interface starts :( I need the program to execute
Main(...) and then to normaly run the windows up.
Jarod
Jarod <Ja***@discussi ons.microsoft.c om> wrote: But I have something like this: I wrote a Windows form application, and now I need to add some command line parameter. The problem is, when I use Main(...) the program executes only the main, no windows form interface starts :( I need the program to execute Main(...) and then to normaly run the windows up.
You'll already have a Main method, which should include Application.Run
somewhere in it - just put your parameter handling stuff before the
call to Application.Run .
--
Jon Skeet - <sk***@pobox.co m> http://www.pobox.com/~skeet
If replying to the group, please do not mail me too
Hi,
As Jon's said it's tricky to live in both world, I tried it once, did not
work at the first try and I moved along, the solution I got was to have two
separated programs, one was the command line version, the other the windows
version, all the logic was implemented in a dll that both programs share so
no duplicated code ( only the config class that was copied verbatim )
If you need to go from command to win. app to could create a new process
and exec the win app. It should work fine.
Cheers,
--
Ignacio Machin,
ignacio.machin AT dot.state.fl.us
Florida Department Of Transportation
"Jarod" <Ja***@discussi ons.microsoft.c om> wrote in message
news:0F******** *************** ***********@mic rosoft.com... Hey I have already written a program that has a user interface, but I would
like to add some command line interface too. So if the user run it like: program.exe paramater1 The program do something, but If not, the program normally run with
windows interface. I tried Sub Main(args[] ... ) but I don't know how to connect it together. Jarod
Hi,
I'm a little confused, do you need to perform any input/output to the
console?
IF you do , then you have a problem ( see my other post)
IF you dont and all you need is to accept some parameters, perform some
action ( without using in any way the console ) and then create the form you
can do it using a windows app, just change the static void Main( ) to
static void Main( string[] args ) and remember that args[0] is the first
parameter, not the program being executed !!!
cheers,
--
Ignacio Machin,
ignacio.machin AT dot.state.fl.us
Florida Department Of Transportation
"Jarod" <Ja***@discussi ons.microsoft.c om> wrote in message
news:5A******** *************** ***********@mic rosoft.com... Are you writing in C# or VB.NET? This is a C# group, but Sub Main looks very much like VB.NET... Yeah it was mistake, because I also use a VB.Net. Writing something with both a command line interface and a windows interface is relatively tricky, I believe. I suspect there's a way to write a console application and then have it "disconnect " from the console if you're running it in Windows mode, but I don't know how you'd do the disconnection.
To use command line parameters for your Windows app, just change the signature of Main from
static void Main()
to
static void Main (string[] args)
and work from there.
But I have something like this: I wrote a Windows form application, and now I need to add some command
line parameter. The problem is, when I use Main(...) the program executes only
the main, no windows form interface starts :( I need the program to execute Main(...) and then to normaly run the windows up. Jarod This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics |
by: Joe |
last post by:
I'm using Python 2.4 on Windows XP SP2.
I'm trying to receive a command line argument that is a newline (\n)
Here is the command line to use
sample.py "\n"
Here is a sample.py script
|
by: Steve M |
last post by:
I'm trying to invoke a Java command-line program from my Python program
on Windows XP. I cannot get the paths in one of the arguments to work
right.
The instructions for the program describe the following for the
command-line arguments:
java -jar sforcedataloader.jar -Dsalesforce.config.dir=CONFIG_DIRECTORY
They also give an example:
|
by: lkrubner |
last post by:
I'd like to write a PHP script to be used from the command line on a
Unix machine. I'd like for the script to put together a string, turn it
into a web page, print it, then return control the command line.
Obviously it is quite easy to make a string that is valid HTML and send
it to the printer. The tough part is making look like a web page. In
particular, image tags should print out as images, not image tags.
Does anyone have an idea...
|
by: randyelliott |
last post by:
Good Day,
I have a MS Access (Access 2000 now upgraded to 2003) database that
tracks customer information. One function of this database is to
create an encrypted license file for our software, which is then
emailed out to the customer. The encryption string is based on
information in the database and can only be generated by executing a
DOS command. This is done from within the database by clicking a
button on a form that triggers a...
|
by: Roman Mashak |
last post by:
Hello, All!
I'm implementing simple CLI (flat model, no tree-style menu etc.). Command
line looks like this: <command> <param1> <param2> ... <paramN> (where
N=1..4)
And idea is pretty simple:
1) get whole string of input line
2) preset table of strings matching <command>
3) preset table of function calls
| |
by: Double Echo |
last post by:
Hi all,
I'm using PHP 4.4.2, and use PHP on both the command-line and the web.
I am running PHP on SuSE 10 Linux , in a VMware 5.5 workstation, using
Apache 2.0.55 , on my Dell laptop. Everything has been running flawlessly
without problems. Very amazing to use VMware, it has worked beautifully.
uname -a
|
by: Bit byte |
last post by:
I have a project that I normally build (without problems) from the
DevStudio IDE. However, I have embarked on automating all my builds
(this test project being one of several).
The project creates a DLL. I am able to build the project without any
probs in the IDE, however - when I build the project from the command
line (using the same options shown in the 'Command line' node in the
'Project Settings' dialog box), I get the following...
|
by: Jim |
last post by:
Hello,
I need a program that will traverse a directory tree to ensure that
there
are unix-style line endings on every file in that tree that is a text
file.
To tell text files from others I want to use the unix "file" command
(Python's "mimetypes" is not so good for me). But I am stuck on
something about getting that output, and I'd greatly appreciate any
pointers.
|
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 Command Prompt or
Browser or some other application?
Ojas.
|
by: Jwe |
last post by:
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.
|
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look !
Part I. Meaning of...
| |
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it.
First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
|
by: Oralloy |
last post by:
Hello folks,
I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>".
The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed.
This is as boiled down as I can make it.
Here is my compilation command:
g++-12 -std=c++20 -Wnarrowing bit_field.cpp
Here is the code in...
|
by: tracyyun |
last post by:
Dear forum friends,
With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
|
by: isladogs |
last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM).
In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules.
He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms.
Adolph will...
|
by: TSSRALBI |
last post by:
Hello
I'm a network technician in training and I need your help.
I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs.
The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols.
I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
|
by: adsilva |
last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
| |
by: muto222 |
last post by:
How can i add a mobile payment intergratation into php mysql website.
|
by: bsmnconsultancy |
last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...
| |