473,473 Members | 1,823 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

Command Prompt or Windows

Hi there,

A console application (.exe) can be executed at Command Prompt or Windows
(double-click).
Is there a way to detect whether if it is executed at CP or Windows?

regards,
Boon
Oct 13 '06 #1
3 1332
Hello TBoon,

I believe your assumption is wrong. I'm fairly certain that you can not
operate in both console and GUI mode from a single app.
This effect is usually accomplished by providing a ".com" console app that
is the equivalent of the ".exe" GUI app. You can ask Windows for the launching
process.. search google or MSDN for details.

-Boo
Hi there,

A console application (.exe) can be executed at Command Prompt or
Windows
(double-click).
Is there a way to detect whether if it is executed at CP or Windows?
regards,
Boon

Oct 13 '06 #2
GhostInAK wrote:
I believe your assumption is wrong. I'm fairly certain that you can
not operate in both console and GUI mode from a single app.
My guess was that he's only ever operating in console mode, but he wants to
tell whether his application was launched by someone opening a command
window and typing in "myapp.exe" in order to run in the existing window, or
by double-clicking the .exe in Windows so that it automatically opened a
console window to run the application.

The only way I could think to do this would be to see what the name of the
process that launched the application is (presumably it would be either
explorer.exe or cmd.exe) but I've no idea how one would find that
information.

--

(O)enone
Oct 13 '06 #3
Hello Oenone,

Unfortunately not everyone uses the Explorer shell or the cmd console. Some
people change their GUI shells (to somethink like Elightenment for Windows
or whatever) and some people use MSH instead of CMD.

Unless you can guarantee your target audience will always and forever use
explorer and cmd, you need to find another way. I don't have a way off the
top of my head.

-Boo
GhostInAK wrote:
>I believe your assumption is wrong. I'm fairly certain that you can
not operate in both console and GUI mode from a single app.
My guess was that he's only ever operating in console mode, but he
wants to tell whether his application was launched by someone opening
a command window and typing in "myapp.exe" in order to run in the
existing window, or by double-clicking the .exe in Windows so that it
automatically opened a console window to run the application.

The only way I could think to do this would be to see what the name of
the process that launched the application is (presumably it would be
either explorer.exe or cmd.exe) but I've no idea how one would find
that information.

Oct 16 '06 #4

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

Similar topics

6
by: EAS | last post by:
Is there any way of using Python to open a command prompt?
2
by: msuk | last post by:
All, I am trying to use Regasm from the command prompt and have to keep putting the full file path of where my assembley is located. Does anyone know how to set it up so wherever I run the...
3
by: Rog | last post by:
Yes, I am guessing that typing cmd in the run windows will bring up the command prompt, but not the vs.net command prompt. Is there a switch(s) for accessing the vs.net command prompt? Or...
4
by: glenn | last post by:
I keep reading all sorts of books on VS that keep telling me to click on Tools/Visual Studio Command prompt to run this program or that program. However, I do not have such a menu choice. Where is...
9
by: Endless Story | last post by:
My last version of Python was 2.4, running smoothly on XP with path c: \Python24 - no need even to include this path in PATH; everything worked as it's supposed to at the command line. Just...
4
by: Ronald S. Cook | last post by:
Currently (manually), I 1) open a Windows SDK Command Prompt and 2) navigate to a particular folder. Then I 3) type a command and press enter. The command is irrelevant (WCF-related) but here it...
4
by: Peter Nimmo | last post by:
Hi, I am writting a windows application that I want to be able to act as if it where a Console application in certain circumstances, such as error logging. Whilst I have nearly got it, it...
1
by: yadin | last post by:
hi! i need to know how i can run ussal commands that i ussally type at the windows command prompt from a python file. that is for example from the windows command prompt i ussually type "cd...
7
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...
4
by: bkamrani | last post by:
Hi, This is a basic problem, but I want to print help content in a Command Prompt in WinXP and scrolling back to see the first lines. If I start a command prompt and run python, and then for...
0
Oralloy
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,...
0
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...
1
isladogs
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...
0
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...
0
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...
0
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
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 ...
0
muto222
php
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
bsmnconsultancy
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...

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.