June 30th, 2013, 09:56 AM
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.
June 30th, 2013, 02:17 PM
June 30th, 2013, 02:57 PM
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.