#1
  1. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Jun 2013
    Posts
    17
    Rep Power
    0

    C program running in windows


    I have done a VERY simple currency converter which runs in the command prompt. is it possible to some how get this to work as a windows program. I would like to be able to save it and send it to my friends. I would also like to be able to change the size of the font add colour and beeps when incorrect information is entered. I don't know what its called when you go from c to a windows program or how its done. Some direction will be greatly appreciated.

    Thanks

    Rodney
  2. #2
  3. Contributed User
    Devshed Specialist (4000 - 4499 posts)

    Join Date
    Jun 2005
    Posts
    4,387
    Rep Power
    1871
    If you dance barefoot on the broken glass of undefined behaviour, you've got to expect the occasional cut.
    If at first you don't succeed, try writing your phone number on the exam paper
  4. #3
  5. Contributing User

    Join Date
    Aug 2003
    Location
    UK
    Posts
    5,110
    Rep Power
    1803
    Note that "Windows" is an operating system - your program you run from the command prompt is (unless you used some ancient 16 bit compiler) still a "Windows Program", it will not run under any other OS without being re-built.

    What you mean by a "Windows Program" is more precisely a "GUI (Graphical User Interface) Program".

    A GUI program, is not distinct from a C program. A GUI program can still be written in C (and many other languages). The basic Win32 API is a C interface, however the Win32 API is huge and ugly and hard work, and has long been out of favour as the preferred way of developing GUI programs. Learning to program at the API level, is to GUI development what assembler programming is to programming languages - you will learn a lot about the fundamentals, but may not get much work done or indeed learn much that is necessary to productivity.

    A GUI program differs from a typical console mode application in that it is event driven, and has an event driven architecture. This leads to a fundamentally different way of coding. In your currency converter, you may in fact have only one event that you explicitly process as such - the clicking of a "Convert" button perhaps. The setting of the input data and the input and output currencies are likely to be entirely independent, whereas in your console version you probably iterate repeatedly through: enter data - select input currency - select output currency - convert.

    Apart from languages, there are two primary elements to most modern GUI programming: a framework, and a visual design tool. A typical GUI program has a lot of overhead just to get started that a simple console mode app does not have, an application framework provides a lot of that code for you so you do not have to deal with the tedious low-level and largely boiler-plate code necessary in most applications.

    Most GUI frameworks on Windows are either C++ based or use .NET (and therefore any .Net language - such as C# or C++/CLI). C++ frameworks for Windows include Microsoft's own MFC, but also Qt, WxWidgets (the latter two being cross-platform - i.e. can be used to build Linux and OSX applications for example). There are very few (if any) C frameworks. GUI development is a domain very suited to object oriented programming, and is where C++ found its first foothold in desktop programming.

    A visual designer is not essential, but without one you will end up writing resource scripts and placing and rendering graphical objects programatically which takes a long time to get the desired "look & feel" right. Good for the soul perhaps, but not for your sanity (or productivity). Being able to draw your interface graphically and then "attaching" code to active elements of it is far more productive and satisfying.

IMN logo majestic logo threadwatch logo seochat tools logo