473,785 Members | 2,154 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Window and console application all in one

Hello everyone,
I'm have a window application, but it is a console application
too. I'll try to explain better: if I call the program without
parameters the GUI starts. Otherwise it runs as a console application.
In other words, I emulate the "certmgr" behavior.
My problem is I cannot display any trace in the console (Someghing
like: Pass 1: OK, Pass 2: etc). Console.Write does not work, because
the window application has not a console. Is there any method to show
redirect the input to the console? Please could you give me any
example?

Thanks all, Gionni
Jul 21 '05 #1
3 2144
Hi, Gionni

compile application as Console project. It will do the trick.
In Main check if arguments are present and act accordingly.

HTH
Alex

"Gionni" <eh*******@kata mail.com> wrote in message
news:d9******** *************** ***@posting.goo gle.com...
Hello everyone,
I'm have a window application, but it is a console application
too. I'll try to explain better: if I call the program without
parameters the GUI starts. Otherwise it runs as a console application.
In other words, I emulate the "certmgr" behavior.
My problem is I cannot display any trace in the console (Someghing
like: Pass 1: OK, Pass 2: etc). Console.Write does not work, because
the window application has not a console. Is there any method to show
redirect the input to the console? Please could you give me any
example?

Thanks all, Gionni

Jul 21 '05 #2
"AlexS" <sa***********@ SPAMsympaticoPL EASE.ca> wrote in message news:<OO******* *******@tk2msft ngp13.phx.gbl>. ..
compile application as Console project. It will do the trick.
In Main check if arguments are present and act accordingly.
Thanks, I tested it and works.
Only one thing more. Is there any way to make the command prompt
disappear when I do a double click on my application?
HTH
Alex


Thanks again, Gionni
Jul 21 '05 #3
Hi, Gionni

You can do this if you get console window handle and hide it using win32
API. Look for GetConsoleWindo w and ShowWindow functions in platform SDK or
on MSDN. You need to get handle of console and do ShowWindow on it with
SW_HIDE parameter. Declarations for functions you can find on
www.pinvoke.net and on several other sites.

HTH
Alex

"Gionni" <eh*******@kata mail.com> wrote in message
news:d9******** *************** **@posting.goog le.com...
"AlexS" <sa***********@ SPAMsympaticoPL EASE.ca> wrote in message

news:<OO******* *******@tk2msft ngp13.phx.gbl>. ..
compile application as Console project. It will do the trick.
In Main check if arguments are present and act accordingly.


Thanks, I tested it and works.
Only one thing more. Is there any way to make the command prompt
disappear when I do a double click on my application?
HTH
Alex


Thanks again, Gionni

Jul 21 '05 #4

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

Similar topics

4
4464
by: Jason Callas | last post by:
I am trying to figure out how to create a console window but cannot figure out how to do this. I know it can be done since the C# and VB console template projects do this but I see no code on how this is done. The only thing I can think of is that there is hidden code to spawn cmd.exe? Then they somehow direct console.read and console.write calls to the spawned process. Any thoughts (and some sample code) would be greatly appreciated.
1
3708
by: gemel | last post by:
I am debugging code that writes to the console window, I select an appropriate line and the select 'Run to Cursor'. The console output does appear and then the window closes. How can I keep this window open without having to put Console.ReadLine() statements in my code? Regards John L
8
11534
by: Mészáros Tamás | last post by:
Hi all, how can I set an app's main window to visible from an other application? My problem is, that I know only the handle of the other app's main process, because the application's main window is set to hidden, so it doesn't have a mainwindowHandle, so I can't send a message to it. Any idea? Thank's in advance,
7
12393
by: Abelard | last post by:
How do I programmatically minimize the console window in a VB .NET console application?
10
6350
by: Stephany Young | last post by:
When one uses the System.Diagnostics.Process.Start method to launch a common or garden Console application, one can set the WindowStyle property of the StartInfo object to ProcessWindowStyle.Hidden so that the window for the Console application is not visible. However, when using some of the 'advanced' properties of the StartInfo object, like Username, Password and Domain, the WindowsStyle property of the StartInfo object is ignored....
12
6543
by: Dilip | last post by:
Hi All I have a server based C# console application. This application must hide its console window when its launched out on the field. So I dutifully P/Invoke'd FindWindow/ShowWindow combination to hide the console window at launch time. The application (for legacy reasons) hangs around by waiting on an old- fashioned Console.ReadLine() statement.
2
4784
by: ssg31415926 | last post by:
Is it possible to create a console app that doesn't display a window? I want to create an app which runs before the main app and starts it in another process and I don't want the console box to appear and disappear as it does at present.
6
3462
by: =?Utf-8?B?R3JlZw==?= | last post by:
I am using the following command to output my results to the Output window (for testing things out). Console.WriteLine ("Output") I'd like to clear the Output window of any previous output. I tried Console.Clear but, this results in an error.
5
10777
by: =?Utf-8?B?SmFtZXMgV29uZw==?= | last post by:
Dear all, I'd like to know if there is any method to minimize command mode window when a console program is running. In my case, there are several console programs which run periodically in server. Now, every console program instance will open a command mode window and they occupy the whole screen. I want to minimize all of them and maximize it if neccessary by manual. Is it possible and how to do it? I'm using VB.NET 2005. ...
0
9646
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, 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...
0
9484
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,...
1
10097
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
9957
tracyyun
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...
0
8983
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
6742
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5518
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4055
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
3658
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.