I'm going to be learning C (finally) next semester, so I started looking in an old book I had on my shelf about C. I couldn't find anything in it about GUI programming, and I can't seem to find any GUI examples on the web either.
Is it practical to create GUI programs in C?
[C] GUIs
Moderator: MaxCoderz Staff
- benryves
- Maxcoderz Staff
- Posts: 3082
- Joined: Thu 16 Dec, 2004 10:06 pm
- Location: Croydon, England
- Contact:
Re: [C] GUIs
If you're on Windows, MSDN has extensive documentation on Win32 GUI development.Wesley wrote:I'm going to be learning C (finally) next semester, so I started looking in an old book I had on my shelf about C. I couldn't find anything in it about GUI programming, and I can't seem to find any GUI examples on the web either.
Is it practical to do anything much in C these days?Is it practical to create GUI programs in C?

- tr1p1ea
- Maxcoderz Staff
- Posts: 4136
- Joined: Thu 16 Dec, 2004 10:06 pm
- Location: I cant seem to get out of this cryogenic chamber!
- Contact:
Re: [C] GUIs
GUI's are overrated anyway!
.

Re: [C] GUIs
If you want nice native controls and obsessively need UIs to behave exactly how you want them to, C is the way to go!
Here are some keywords to get you started:
CreateWindow
GetMessage
DispatchMessage
DefWindowProc
WM_PAINT
BeginPaint
SelectObject
GetStockObject
FillRect
DrawText
EndPaint
The first result in any search engine is always MSDN. The documentation is excellent. I recommend using the Visual Studio 2010 beta. It gives you real time feedback on your C code with error and warning badges in the gutter. The Windows SDK comes with hundreds of samples.
Here are some keywords to get you started:
CreateWindow
GetMessage
DispatchMessage
DefWindowProc
WM_PAINT
BeginPaint
SelectObject
GetStockObject
FillRect
DrawText
EndPaint
The first result in any search engine is always MSDN. The documentation is excellent. I recommend using the Visual Studio 2010 beta. It gives you real time feedback on your C code with error and warning badges in the gutter. The Windows SDK comes with hundreds of samples.
- benryves
- Maxcoderz Staff
- Posts: 3082
- Joined: Thu 16 Dec, 2004 10:06 pm
- Location: Croydon, England
- Contact:
Re: [C] GUIs
Or WinForms+C#.Spencer wrote:If you want nice native controls and obsessively need UIs to behave exactly how you want them to, C is the way to go!

Re: [C] GUIs
I admit WinForms and WPF are pretty nice, I use them for small projects. One problem I've noticed with WinForms is the controls don't smoothly fade to the hot color on mouse-over on Vista and 7. I have a feeling, for buttons at least, they simply use DrawThemeBackground to approximate the control. This is similar to how scrollbars in IE are different than normal scrollbars, since IE uses "window-less" controls.
-
- Calc King
- Posts: 1513
- Joined: Sat 05 Aug, 2006 7:22 am
Re: [C] GUIs
I wouldn't call much about WPF nice - except perhaps some of the resulting graphics. On the other hand, WPF apps usually end up looking like a flash ad, and even when they don't the text rendering is broken by default (has been fixed very recently) and ignores your ClearType setting just for laughs (I am not laughing! ClearType is so horrible on CRT's that it causes your eyes to bleed!)
- benryves
- Maxcoderz Staff
- Posts: 3082
- Joined: Thu 16 Dec, 2004 10:06 pm
- Location: Croydon, England
- Contact:
Re: [C] GUIs
WPF is a nicely designed API and (when you can get your head around its "magic") very pleasant to develop in. However, I do agree with all of your gripes - the text rendering is atrocious, and the look and feel is "off" from native apps (this is due to it not using native rendering at all - everything is driven by theme files, so if you don't use Luna or Aero you end up with a Windows Classic look).King Harold wrote:I wouldn't call much about WPF nice - except perhaps some of the resulting graphics. On the other hand, WPF apps usually end up looking like a flash ad, and even when they don't the text rendering is broken by default (has been fixed very recently) and ignores your ClearType setting just for laughs (I am not laughing! ClearType is so horrible on CRT's that it causes your eyes to bleed!)
I've stuck with keeping WPF for the web (Silverlight) myself.