Introduction to GUI programming with c

I'm new GUI and programming as whole and so far I have a general understanding of c and have spent quite some time writing console applications.

I'm trying to learn GUI but have so far been unsuccessful. I've tried learning wxwidgets (through official documentation), gtk (through official documentation) and win32 (forgers win32 tutorial) but still haven't quite gotten there.

I still really want to but can't seem to find any good material. What would you recommend as start for a beginner?


If you are strictly limited to C, you have only a few choices. GTK+ is probably the easiest for a beginner.

An object oriented language like C++ is far more suited to GUI programming. If you like to use C++, I strongly recommend Qt, mainly because of its very good documentation, with very good tutorials especially for beginners.


I wouldn't suggest trying to do GUI with C. It's not really that comfortable to do so.

But if you really want to do it. Here's a quite nice tutorial on Windows API.

You can also use a library like Allegro, it is meant for games, but can be equally useful in programs.

But the way I would suggest is, first learn the basics of GUI and application (that means state machine) programming with a simple language (any simple will do, personally would suggest Lua with Löve2D platform). And then use the knowledge you got in C. The state machine and event-flow will be harder to grasp if you have to deal with garbage collection and pointers... (it's still possible to learn).


I'd suggest you should try to learn some object oriented programming properly with a language such as Objective C or C++, since GUI programming is difficult. Particularly even more so in C.

A lot of the concepts in GUI programming revolves about you knowing how objects work, with all the widgets that are composed in any GUI framework, and how they interact together. There is also the concept of events that sends messages from one input source to a graphical component (or between two graphical components).

In summary: it becomes a lot easier to read through documentation when you know what the objects are all about… and even then there is a lot to take in.

链接地址: http://www.djcxy.com/p/42926.html

上一篇: 递归下降解析器和函数式编程

下一篇: 用c编程介绍GUI编程