I want to do Graphics programming in C. I had searched a lot about the compiler that provides a rich set of functions for doing GUI programming in C, but I couldn't find anything.
Active4 months ago
Basically I want to draw buttons and then accept the choice from the user and take an appropriate action. It would be helpful if you can suggest a C compiler, or a library that I can add to my compiler. I am working on the Windows operating system.
Visual C++ and MFC Fundamentals Table of Contents © FunctionX, Inc. 1 an action creates a document and this document must reside somewhere. Graphical User Interfaces. They have largely been supplanted by GUI-based applications. Programming languages support the development of graphical.
Presently, I am using TURBO C compiler that does not support direct methods for creating buttons. Any help would be appreciated.
athspk
5,87677 gold badges2828 silver badges5151 bronze badges
AlgorithmistAlgorithmist
4,12477 gold badges2828 silver badges4848 bronze badges
closed as not constructive by Bo Persson, martin clayton, Wh1T3h4Ck5, ughoavgfhw, LuciferSep 30 '12 at 3:37
As it currently stands, this question is not a good fit for our Q&A format. We expect answers to be supported by facts, references, or expertise, but this question will likely solicit debate, arguments, polling, or extended discussion. If you feel that this question can be improved and possibly reopened, visit the help center for guidance. If this question can be reworded to fit the rules in the help center, please edit the question.
6 Answers
This is guaranteed to have nothing to do with the compiler. All compilers do is compile the code that they are given. What you're looking for is a GUI library, which you can write code against using any compiler that you want.
Of course, that being said, your first order of business should be to ditch Turbo C. That compiler is about 20 years old and continuing to use it isn't doing you any favors. You can't write modern GUI applications, as it will only produce 16-bit code. All modern operating systems are 32-bit, and many are now 64-bit. It's also worth noting that 64-bit editions of Windows will not run 16-bit applications natively. You'll need an emulator for that; it's not really going to engender much feeling of accomplishment if you can only write apps that work in a DOS emulator. :-)
Microsoft's Visual Studio Express C++ is available as a free download. It includes the same compiler available in the full version of the suite. The C++ package also compiles pure C code.
And since you're working in Windows, the Windows API is a natural choice. It allows you to write native Windows applications that have access to the full set of GUI controls. You'll find a nice tutorial here on writing WinAPI applications in C. If you choose to go with Visual Studio, it also includes boilerplate code for a blank WinAPI application that will get you up and running quickly.
If you really care about learning to do this, Charles Petzold's Programming Windows is the canonical resource of the subject, and definitely worth a read. The entire Windows API was written in C, and it's entirely possible to write full-featured Windows applications in C. You don't need no stinkin' C++.
That's the way I'd do it, at least. As the other answers suggest, GTK is also an option. But the applications it generates are just downright horrible-looking on Windows.
EDIT: Oh dear... It looks like you're not alone in wanting to write 'GUI' applications using an antiquated compiler. A Google search turns up the following library: TurboGUI: A GUI Framework for Turbo C/C++:
If you're another one of those poor people stuck in the hopelessly out-of-date Indian school system and forced to use Turbo C to complete your education, this might be an option. I'm loathe to recommend it, as learning to work around its limitations will be completely useless to you once you graduate, but apparently it's out there for you if you're interested.
Cody Gray♦Cody Gray
200k3737 gold badges403403 silver badges486486 bronze badges
The most famous library to create some GUI in C language is certainly GTK.
With this library you can easily create some buttons (for your example). When a user clicks on the button, a signal is emitted and you can write a handler to do some actions.
Sandro MundaSandro Munda
27.1k1818 gold badges8585 silver badges113113 bronze badges
Use win APIs in your main function:
Then write another function which handles win's messages (mentioned in #1). When you receive the message WM_CREATE you have to call CreateWindow(). The class is what control is that window, for example 'edit' is a text box and 'button' is a.. button :). You have to specify an ID for each control (of your choice but unique among all). CreateWindow() returns a handle to that control, which needs to be memorized. When the user clicks on a control you receive the WM_COMMAND message with the ID of that control. Here you can handle that event. You might find useful SetWindowText() and GetWindowText() which allows you to set/get the text of any control.
You will need only the win32 SDK. You can get it here. ![]()
15.9k88 gold badges3434 silver badges6969 bronze badges
C is more of a hardware programming language, there are easy GUI builders for C, GTK, Glade, etc. The problem is making a program in C that is the easy part, making a GUI that is a easy part, the hard part is to combine both, to interface between your program and the GUI is a headache, and different GUI use different ways, some threw global variables, some use slots. It would be nice to have a GUI builder that would bind easily your C program variables, and outputs. CLI programming is easy when you overcome memory allocation and pointers, GUI you can use a IDE that uses drag and drop. But all around I think it could be simpler.
sergiosergio
Windows API and Windows SDK if you want to build everything yourself (or) Windows API and Visual C Express. Get the 2008 edition. This is a full blown IDE and a remarkable piece of software by Microsoft for Windows development.
All operating systems are written in C. So, any application, console/GUI you write in C is the standard way of writing for the operating system.
Derek Hogue
4,54411 gold badge1111 silver badges2727 bronze badges
VijuViju
A C compiler itself won't provide you with GUI functionality, but there are plenty of libraries for that sort of thing. The most popular is probably GTK+, but it may be a little too complicated if you are just starting out and want to quickly get a GUI up and running.
For something a little simpler, I would recommend IUP. With it, you can use a simple GUI definition language called LED to layout controls (but you can do it with pure C, if you want to).
C Gui Programming Tutorial Pdf PdfDavid BrownDavid Brown
25.8k1010 gold badges7575 silver badges113113 bronze badges
Not the answer you're looking for? Browse other questions tagged cwindowsuser-interfacegraphics or ask your own question.-->
This section provides detailed information on key C# language features and features accessible to C# through the .NET Framework.
C++ Gui Tutorial
Most of this section assumes that you already know something about C# and general programming concepts. If you are a complete beginner with programming or with C#, you might want to visit the Introduction to C# Tutorials or Getting Started with C# interactive tutorial, where no prior programming knowledge is required.
For information about specific keywords, operators and preprocessor directives, see C# Reference. For information about the C# Language Specification, see C# Language Specification.
C Gui Programming TutorialProgram sectionsC Gui Programming Tutorial Pdf FreeLanguage SectionsPlatform SectionsOnline C Programming TutorialSee alsoComments are closed.
|
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |