tags:

views:

1552

answers:

14

I'm very new to programming, and I'd like to write a Windows Application. So far I've read Teach Yourself C in 24 Hours, what should I do (tutorial to read) next to accomplish my goal? Thanks

+7  A: 

When I first started developing applications for Windows (about 15 years ago) I recall reading some very useful stuff by Charles Petzold. His more recent books are about C#, but his older books are still relevant because the Win32 API has not changed that much when it comes to the basics.

Colin Mackay
Specifically [Programming Windows](http://www.charlespetzold.com/pw5/index.html) and you'll learn a lot about the nuts and bolts of Windows.
artlogic
+1. the Petzold book gives a really good grounding to basic Win32 development.
Paul Dixon
Programming Windows is a great book.
toast
A: 

Read this.

Are you suggesting that you'd like to write a Windows desktop app in C? That's reaching back a long way. You're back in 2002, according to this.

Most people writing on Windows are using .NET, which means C++ or C#.

duffymo
I don't think it's a bad idea to write _one_ in C.
Nosredna
Not a bad idea by any means, Nosredna. I'm not a Windows programmer, so I don't even know if the Petzold APIs are still available. I'd be using C++ as "a better C" if I were still writing it.
duffymo
Well, he could certainly use the C++ compiler and treat it like C if he wants.
Nosredna
+6  A: 

Hello, World!

Write the famous "Hello, World" program (Google it if unsure):

  1. To output text to the console.
  2. To output text to a dialog window.
  3. To make the dialog appear after selecting a menu item.

Then, if you are still keen:

  1. Write a program that allows a person to type in text into a text field. Display that text in a dialog window after clicking a button.
  2. Save the text to a file.
  3. Write a program to read the file and display its contents in a window.

That should get you started learning the fundamentals of what is happening when writing a Windows application.

Also, read all the links that people recommend you read, in this thread and others.

Old vs. New

Advice for learning .NET, C#, and C++ is great. Those technologies hide a lot of the boring "grunt" work for you. I still feel it is good to have an understanding of what is happening at a lower level for various reasons, including:

  • Learning C is applicable to more than Windows-based applications (some would argue .NET and C# are portable, which is true in theory, whereas ANSI C and Java are portable in practice).
  • Understanding what is hidden will allow you to avoid technical blunders and diagnose deep technical issues.

At this point it really depends on your goals. If all you want to do is write a Windows application, then use modern technologies that are better suited to such a task. If you want to write a Windows application with an understanding of how to write applications in general (not necessarily just for Windows), then keep pursuing the C path for now, and branch into other technologies as you expand your knowledge.

Dave Jarvis
+1  A: 

If you need some GUI or complex features, You need some oriented object programming skills...
You can read some of this book serie : Head first... from O'Reilly

  1. Head first Object-Oriented Analysis and Design
  2. Head First Software Development
  3. Head first C# or Java (It doesn't matter which language...)
  4. Trolltech Qt4, it's a must, too ! Thanks CptAJ

They are very nice books for beginners... and advanced programmers too ;-)

Nice reading !

Matthieu
If he's learning C why would object oriented skills help? C is a procedural language. Of course, if your recommendation is that he should really be learning C# or Java then your suggestion is valid, but you haven't recommended a different language.
Colin Mackay
You can do Windows programming without OOP! Plain C is enough.
PhiLho
Because most of windows application with GUI need it !
Matthieu
You can write GUI Windows apps in C. Probably hundreds of thousands of GUI Windows apps have been written in C. I think C# makes the most sense now, but C certainly works.
Nosredna
While it is certainly easier to write windows applications in an object oriented language, it is still perfectly possible to do so without.
Colin Mackay
Yes, but today, I think that a beginner have to know these concepts ... He will develop faster and more complex and maintainable applications !
Matthieu
If he's just starting out, he should focus on just programming to start with. The GUI stuff is a little cumbersome to a beginner.
NoMoreZealots
+4  A: 

Depends on the application. But what you need now is to familiarize yourself with an API. APIs are basically premade functions that you use as tools to do... whatever it is the API was designed to help you do. You're looking for a graphical user interface API. Windows has its own but I recommend you use something crossplatform so your application will work on multiple platforms.

Look these up on wikipedia:

GTK+

Trolltech's QT4

They can pretty much do anything the windows API can do with the added benefit of working on multiple platforms like windows, linux, mac, etc.

CptAJ
A: 

Try Ramp Up's Developer Basics, a microsoft learning road that shows stpe by stpe how to start windows programming. You can use the Visual C# Express version of Visual Studio as a development enviroment.

Wilhelm
A: 

I would suggest using VB rather than C#. The syntax is a little friendlier, and it has all equivalent features and performance.

Why not follow the MSDN tutorials? If you don't like them try googling "VB tutorial".

http://msdn.microsoft.com/en-ca/library/hewcw458.aspx

Either VB or C# has a zillion examples of everything that can be googled. I would stick to either of these languages, if only for the "google support" alone.

Larry Watanabe
+1  A: 

http://winprog.org/tutorial/

These are pretty good for learning Win32. Charles Petzold is good resource if you can get your hands on a copy but The Forger's are free and you can have them in your hot little hands right now.

In general though you should spend some time just writting C/C++ apps that use the standard libraries first. Opening files, writing output, writing files, reading/writing stdio and get a good handle on the basics of the language first.

Looking up books on data structures, and analysis of algorithms are fundemental to any type of programming you want to do as well.

NoMoreZealots
A: 

The next thing you should do is forget about C and go with C#/.NET. C (and C++ IMO) is obsolete for writing non-graphics-intensive desktop apps, especially for beginners. C# isn't just easier, it's more modern.

Christopher
A: 

I disagree with a lot of the answers here... learning from the ground up is not a bad thing.

I wouldn't go out and make a whole app in C, but certainly making a little app in C is a good way to both learn the language and to appreciate (or more likely, detest) the win32 API.

Besides, you can't really appreciate what the newer languages/frameworks do for you if you don't experience the old painful way of doing things.

That said, recognize that there are newer languages and frameworks out there and learn them as well; particularly if you're trying to land a job.

Giovanni Galbo
A: 

Read this book, Learn to Program with C#.

Then, make small projects in WPF; the best WPF book is Windows Presentation Foundation Unleashed; try that after reading the C# / beginning-programming book.

C#, the .NET Framework and WPF were created to move beyond the C Win32 API, to make it easier to create Windows applications.

If you want to make a standard Windows application, follow that path.

GreenReign
+1  A: 

I highly recommend theForger's Win32 API Programming Tutorial. It's very concise and easy to follow, and it's free.

haggag
A: 

While I won't say you've wasted your time learning some C, I'm guessing it's not where you're going to end up either.

If you really want to get rolling, without too much trouble, I'd highly suggest getting:

This should get you pretty much exactly what you want. You'll have everything you need, and Petzold starts you out very simply, and ramps you up to making interesting apps without losing you.

(You may wonder why I, and many other people are directing you to C# or other languages after you specifically said that you've already read and learned about C. This is because programming in windows using the old Win32 API is much more tedious. It is easy to quickly become overwhelmed by the sheer amount of extra chaff that has to go into it.)

Beska
Why did you compare a Win32 application that displays a full GUI and paints "Hello World" on the screen to a C# console application? It's like comparing apples and trash cans. Yes, a C# GUI app is still easier than a Win32 GUI app, so your point still stands, I'm just confused as to why you'd try and make it this way.
unforgiven3
You compare the basic Hello world console program with the Win32 window app.#include <stdio.h>int main(void){printf("hello world");return 0;}
toto
The two programs are not comparable. The C version should be a one-line call to MessageBox() if you're going to use MessageBox.Show() in C#.
ChrisV
Okay, forget it. Although they were slightly different, I was just trying to illustrate a point. All gone.
Beska
+1  A: 

At Microsoft, we have been working hard to come up with some great resources for simply creating Windows applications. Our page, Start Programming with Windows 7, will be sourced with tons of new resources for intermediate and advanced programmers.

There are two really important new learning series that we have been working on:

  • The Hilo Project: An application built from the ground up to show how you can develop programs that are specifically taylored to Windows 7 features using the most modern programming and application design methodologies.
  • The Learn to Program for Windows Module: An introduction to Windows programming written by a developer education expert at Microsoft. This module sounds more like what you are looking for, I recommend you check it out.

We're working on ways to surface learning resources as best we can on the Windows Developer Center - a collection of developer learning resources for people new to developing Windows or new to developing using the latest Windows features.

Additional guidance is coming through the new Home and Hub resources for client / Desktop applications on the MSDN homepage.

Gus Class