locked
How it works RRS feed

  • Question

  • Hey guys I'm very new to the whole programming industry. And I just downloaded the visual studio Ide and this all seems very interesting to me but I would just like to know about the "Console application ".I have seen a lot of tutorials and how people write their code in there but I just don't understand how that could turn out to be a programme on a pc. And then I read the article about how to create a calendar using a "GUI" and that seemed more like a programme to me I would just like to know what's the difference so if I decide to be one day work in this industry which one would I use more and why..so that I can practice and develop my knowledge more on that peace of c# programming. 
    Friday, July 4, 2014 7:19 PM

Answers

  • There isn't much difference except the interface.  Dos was developed before windows and DOS (a console application) did not had very limited graphics capabilities.  Here are some minor differences between console and GUI.

    1) Console application terminates when it is finished.  GUI usually stays running until user closes the window.

    2) Console application usually takes inputs from keyboard and displays output as text in a window.  GUI users Form controls and can display as text or graphics.


    jdweng

    • Marked as answer by Fred Bao Monday, July 14, 2014 7:40 AM
    Friday, July 4, 2014 9:31 PM

All replies

  • There isn't much difference except the interface.  Dos was developed before windows and DOS (a console application) did not had very limited graphics capabilities.  Here are some minor differences between console and GUI.

    1) Console application terminates when it is finished.  GUI usually stays running until user closes the window.

    2) Console application usually takes inputs from keyboard and displays output as text in a window.  GUI users Form controls and can display as text or graphics.


    jdweng

    • Marked as answer by Fred Bao Monday, July 14, 2014 7:40 AM
    Friday, July 4, 2014 9:31 PM
  • Hello Cyperus, and welcome to MSDN. I'll do my best to give you an overview on Windows programming. There will be a lot of stuff covered, so I will be linking relevant MSDN articles in parenthesis. Just a bit of background: CPU's directly run a programming language called assembly. It is very difficult to write a program in assembly, so that's why people begin to write low level programming languages like C, and eventually high ones like VB. DOS programs (Window's predecessor) were originally written in pure assembly, they had the file extension of .com . MS-DOS would allocate space and the program would run. Beginning from MS-DOS 2.0 Microsoft created executable files with the extension of .exe though there are many different kinds (MZ, LX, LE, etc.) The difference between .exe and .com is that .exe had metadata that would instruct Windows about the program and how to run it. This makes program developing much easier, because Windows would help you allocate the space for your variables, and it could allow the user to run several different programs at once, because they were handled by Windows. Now, the beginning versions of Windows (1, 2, 3, 95, 98, etc.) actually were running MS-DOS, they just ran Windows on top of it. Then Microsoft decided to start over and create a new family of Operating Systems for Windows called Windows NT. They tried to implement this in Windows ME... that failed horrifically. But in their next version of Windows, Windows 2000, it was implemented. This added a new type of executable, the Portable Executable. (This is known as PE32 executables for x86 (32 bit) applications and PE32+ for x68-64 (64 bit) applications.) Portable Executables are actually based on the Common Object File Format, that was used in UNIX. As Windows 8.1 is in the Windows NT family, we still use PE's. (It's also important to note that now PE's have extensions such as .dll and .drv and .ocx and .sys and more. Each extension means that the PE has a different purpose (this will be explained later)). There are 2 types of PE's in more recent versions of Windows. Unmanaged and managed. When you think of programming you are probably thinking about unmanaged. (The main unmanaged language for Windows is C++ http://msdn.microsoft.com/en-us/library/windows/desktop/ff381399(v=vs.85).aspx ). Unmanaged programs are pretty independent, in that Windows reads metadata and then loads the program into memory. Then Windows doesn't really interfere with the program. One thing to note is that unmanaged applications are compiled into assembly language. Windows does have some control over the programming running, but not a lot. Then Microsoft make interfaces to help applications such as COM (Component Object Model), ActiveX, OLE, etc. But in the end, the most recent (and my personal favorite ;) ) one is the .NET Framework ( http://msdn.microsoft.com/en-us/library/w0x726c2(v=vs.110).aspx ). Applications that implement the .NET Framework are called managed. The .NET Framework provides resources such as garbage collection, and security checks. Windows controls your program much more, but it's much easier to write programs for the .NET Framework. Windows runs your managed applications using Common Language Runtime (http://msdn.microsoft.com/en-us/library/8bs2ecf4(v=vs.110).aspx ). It's called this because managed applications are compiled into CIL (common intermediate language) instead of assembly. This allows different kinds of computers to run the same application. The most common .NET languages are C# (http://msdn.microsoft.com/en-us/library/kx37x362.aspx ) Visual Basic (VB) (http://msdn.microsoft.com/en-us/library/2x7h1hfk.aspx ) and F#(http://msdn.microsoft.com/en-us/library/dd233154.aspx ). So by now, you're probably frustrated that you don't have your answer, but now I can finally explain it. When creating Windows NT Microsoft created Subsystems. A subsystem specifies the environment for an executable. Windows can use a subsystem for native (unmanaged) code and managed code. There is a console subsystem and a Windows subsystem (GUI). There are also a subsystem for drivers. All the subsystems can be found at http://msdn.microsoft.com/en-us/library/fcc1zstk.aspx . The extension of a PE can give away it's information. sys and drv files are drivers, while a dll is a Dynamic-Link Library (you can think of this as compiled code, but without a start point, so unless a .exe loads it, it won't run). ocx files are dll's for ActiveX. I should also mention that COM isn't gone, in fact Microsoft has recently created Windows Runtime to run metro applications, which was based on COM. Windows Runtime also uses JavaScript, HTML, XAML for it's applications. Windows Phone Runtime is very similar to Windows Runtime.

    This was a lot, I know, but I truly believe that all of this information is relevant when programming, so to sum it up here's the basic points.

    • Console applications use a different subsystem than GUI applications, which means they run in a different environment.
    • Console applications are great for creating utilities that will be called by Windows, and not a user (for example something that renames all of your files, that is called when a user clicks on a .lol file would be a better console application).
    • Console applications are good for beginners to get a feel of their .NET language
    • GUI applications are more likely used when a user needs to interact with the application (especially if it's not for an IT crowd)
    • My suggestion is to make a few Console applications so you understand the C# syntax, but when you are more comfortable dive into the default GUI application, and analyze how it works, and then create your own!

    Happy programming!


    Sincerely, Jakeinc

    Friday, July 4, 2014 9:46 PM
  • Hi Cyperus,

    To make a long story short, a console app will run in DOS (cmd). It won't have any buttons, labels, pictureboxes or anything fancy (like Colossal Cave Adventure!).

    On the other hand, the Windows Forms Application will make it possible for you to create programs that look a lot like other Windows programs.

    Hope it helps,

    AadiB


    PS: This is what I have interpreted until now. If anybody thinks I am wrong, please feel free to make me aware of my mistake.
    • Edited by AadiB Saturday, July 5, 2014 5:38 AM
    Saturday, July 5, 2014 5:37 AM