Hello, my app is written in C#. Given an app file path (e.g. e:\abc.exe),
how can I determine if it's a winform app or a console one. (note: abc.exe
can be either a native exe or a .net one) 6 4580
On May 11, 4:43*pm, "None" <n...@none.comw rote:
Hello, my app is written in C#. Given an app file path (e.g. e:\abc.exe),
how can I determine if it's a winform app or a console one. (note: abc.exe
can be either a native exe or a .net one)
Hi,
Try to run the application from command prompt (cmd.exe) then if it's
a winform application the application's main form is opened as window,
if not, the program is started and output is visible inside command
prompt as just a guess to verify, better ideas may exist.
Thanks,
Onur Güzel
"None" <no**@none.comw rote:
Hello, my app is written in C#. Given an app file path (e.g.
e:\abc.exe), how can I determine if it's a winform app or a console
one. (note: abc.exe can be either a native exe or a .net one)
You will need to study the Portable Executable (PE) file format. http://www.microsoft.com/whdc/system...re/PECOFF.mspx
Then you can open the .exe file with a BinaryReader and pick out the
information you need.
Eq.
On Sun, 11 May 2008 06:43:31 -0700, None <no**@none.comw rote:
Hello, my app is written in C#. Given an app file path (e.g. e:\abc.exe),
how can I determine if it's a winform app or a console one. (note:
abc.exe
can be either a native exe or a .net one)
One way would be to use the "Debug Help" library
( http://msdn.microsoft.com/en-us/libr...9(VS.85).aspx). You can
use the ImageNtHeader() function to retrieve the PE headers for the
executable, and then check the subsystem information to see whether it's
GUI or command-line.
Note that a console application can in fact create a GUI. It's not really
clear why you're trying to do this, but keep in mind that you may or may
not be able to reliably accomplish your goal, depending on what
applications you're dealing with and why you really want to know whether
they are console or GUI.
Pete
thanks. I am looking into the pe file format.
"Paul E Collins" <fi************ ******@CL4.orgw rote in message
news:qb******** *************@b t.com...
"None" <no**@none.comw rote:
>Hello, my app is written in C#. Given an app file path (e.g. e:\abc.exe), how can I determine if it's a winform app or a console one. (note: abc.exe can be either a native exe or a .net one)
You will need to study the Portable Executable (PE) file format. http://www.microsoft.com/whdc/system...re/PECOFF.mspx
Then you can open the .exe file with a BinaryReader and pick out the
information you need.
Eq.
In article <op************ ***@petes-computer.local> , Peter Duniho
wrote:
Note that a console application can in fact create a GUI.
Which means a specific executable can be BOTH a console application and
a GUI application.
Mike
On Wed, 14 May 2008 03:51:04 -0700, Mike Blake-Knox
<mi****@communi ty.nospamwrote:
In article <op************ ***@petes-computer.local> , Peter Duniho
wrote:
>Note that a console application can in fact create a GUI.
Which means a specific executable can be BOTH a console application and
a GUI application.
Well, that all depends on your definition of "GUI application". That's
true from a behavioral point of view, but it's not true from a PE
configuration point of view.
We don't have any information from the OP that would help us understand
why he wants this information at all, never mind which is the more
appropriate definition. :)
Pete This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics |
by: Ron Vecchi |
last post by:
I am looking for a way to write xml data to file from a macromedia flash
executable. I was thinking about haveing flash call a console app with a
parameter...which is the xml string to write to file.
But is there a way to supress the console window from poping up. So there
is no visual effect of calling the console app?
--
Ron Vecchi
|
by: Barry Mossman |
last post by:
Hi,
can I detect whether my class is running within the context of a Console
application, vs say a WinForm's application ?
also does anyone know whether the compiler or runtime is smart enough to
avoid the overhead of writing to the console if it is not visible, eg I
am running inside a WinForm application.
thanks
|
by: Steve |
last post by:
I have created a console app that simply prints out a message a couple
times, then exits, here is the code:
<code>
for(int i = 0; i < 10; i++)
{
System.Threading.Thread.Sleep(500);
Console.WriteLine(String.Format("Sleeping...{0}", i));
}
Console.WriteLine("Done!");
</code>
|
by: Scott |
last post by:
Hi everyone,
I have a c# console app that when run through an autorun.inf file, launches
a web page from the CD. It works just fine but I would like the console
window minimized on startup. Currently, the console window displays briefly,
the web page loads, and the console window disappears.
The only line of code currently in the console app is...
System.Diagnostics.Process.Start("blahblahblah.htm")
|
by: RobcPettit |
last post by:
Hi, This is probably a mute point, but id like to know when to choose a
console application to a windows application. What i meen is this. Most
coding in books is with the console application. I think this is
possibly because as a beginner its easier to demonstrate c# principles.
But I got to thinking if Im writing an application that needs no user
input, and the only information shown to the user is how many records
are proccesed, do i...
| |
by: =?Utf-8?B?UmljaA==?= |
last post by:
Hello,
What is the way to determine what control the mouse is over on a form? Like
if the mouse is over a button you could note this in the form's MouseMove
Event
'--pseudocode here
console.Writeline(mouse.HitestInfo.ToString)
Does a winform have anything like the Datagridview.HitTestInfo thing? How
|
by: joey.powell |
last post by:
I have a windows form app in C# in VS2005. In the "program.cs" file, I
take some command line arguments and use "Console.WriteLine("fsdfsd")
to give feedback to users. When I step through the program, the code
block is executing, but no text is written to the command line.
What might be causing this?
|
by: ffimbel |
last post by:
Hi
I would like to implement a single exe which could be invoked either
as a standard windows form (no argument) or as a console app (when run
with app.exe -nologo).
I tried compiling the exe as a winform app and use win32 app to create
a console but when launched from a dos command line, it does not use
the launching console but create a new one
|
by: paul korosi |
last post by:
Hi, I've got a wcf service that is hosted on my local machine. I need to
determine the hosted url of the service from within the service but cannot
work out how to do it.
HttpContext.Current always returns null, which i suppose might make some
sense. Does anyone know of a way to get the url?
TIA,
paul
|
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: jinu1996 |
last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth.
The Art of Business Website Design
Your website is...
|
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,...
|
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...
|
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();...
|
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
| |
by: muto222 |
last post by:
How can i add a mobile payment intergratation into php mysql website.
| |