Thread: From the command line to the windows...

  1. #1
    Registered User
    Join Date
    May 2004

    Lightbulb From the command line to the windows...

    I have been learning C++ for a little while now, and of course all my programs run in the command line, doing what they have to do.

    But, recently I have been wondering: How do I make my programs run in a window? Because I noticed most of the popular programs don't run from the command line, but are window-based (like Microsoft Word, Notepad, KaZaa). Is it possible to do this in C++, or is this not the language for me?

    All help is appreciated -- Thanks, jason.

  2. #2
    l'Anziano DavidP's Avatar
    Join Date
    Aug 2001
    Plano, Texas, United States
    >Is it possible to do this in C++

    Of course it is.

    The reason you have only programmed in the command line so far is because teachers and books usually start out teaching the actual language and concepts first, and then after you are good with the language, you can learn how to use windows, etc. (in the programming world, it is normally called GUI programming when you develop applications that work in a window and use buttons and such).

    There is something called the Windows API, you might have heard of it before. It comes with almost every C++ compiler that is made for the Windows environment. All you have to do is say:

    #include <windows.h>

    And you can start programing for Windows!

    Of course it isn't all that easy. I suggest getting a good book to help you along. And don't get discouraged! Everybody despairs the first time they see Windows code because it looks completely foreign to them, but after awhile you get used to it and become pretty good with it. It just takes a lot of practice.

    There are plenty of books out there that can teach Windows programming. I dont know the names of any off the top of my head. Just go to your local bookstore and flip through them all.

    By the way, most Windows applications are made in C and C++, if you have had any doubts about what C++ can do. It is pretty much one of the most powerful languages out there. Lately some programs have been made in Java and also C#, but those are definitely in the minority.
    My Website

    "Circular logic is good because it is."

  3. #3
    Registered User
    Join Date
    May 2004
    Very neat, indeed. Thanks a bunch, DavidP, you've been a great help. Time to get going to my local bookstore!

  4. #4
    Hardware Engineer
    Join Date
    Sep 2001

    Thumbs up Petzold!

    The standard book for learning Windows programming is Programming Windows by Charles Petzold. Just about every Windows programmer owns this book.

    Like DavidP said, " isn't all that easy." There is a lot of overhead in windows programming... there isn't a simple "MakeWindow()" function. Petzold's first "Hello Windows" example is almost 2 pages long, and it's all special typedefs, structures, and functions defined in the <windows> header. When you first see it, you won't understand much of it. Don't worry, Petzold does explain it.

    Here's a link to some Windows Tutorials.

    You don't have to know any really advanced C++ to learn Windows programming, Petzod only uses C. But I always advise to keep studying and learning the underlying standard C++ language, so that your programs not only look, but run well... making good use of the language.

  5. #5
    Registered User
    Join Date
    Nov 2001
    Also check out MFC.


Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Windows 98/2000 programming in Windows XP
    By Bill83 in forum Windows Programming
    Replies: 3
    Last Post: 07-22-2005, 02:16 PM
  2. Dialog Box Problems
    By Morgul in forum Windows Programming
    Replies: 21
    Last Post: 05-31-2005, 05:48 PM
  3. dual boot Win XP, win 2000
    By Micko in forum Tech Board
    Replies: 6
    Last Post: 05-30-2005, 02:55 PM
  4. SDL and Windows
    By nickname_changed in forum Windows Programming
    Replies: 14
    Last Post: 10-24-2003, 12:19 AM
  5. IE 6 status bar
    By DavidP in forum Tech Board
    Replies: 15
    Last Post: 10-23-2002, 05:31 PM