Thread: pretty windows?

  1. #1
    Registered User
    Join Date
    May 2009
    Posts
    242

    pretty windows?

    I'm a complete programming newbie but reaching the point where I can at least do a few things in C++.

    But... essentially all I've done at this point is create programs of various kinds where the graphic interface (from MS Visual C++) is just a black-screen window with old DOS-style lettering on it. And a similar window comes up if you just run the executable file outside of the MS IDE.

    But C++ has to at some point allow you to create prettier interfaces from which to run these programs. Is that something I'll just eventually get to as part of C++, or does it involve calling up a C++ executable from some kind of graphic interface program or something like that? If the latter, what are some good graphic interface programs that are often used for interaction with C++?

    Is this something I should just keep on hold at least in practical terms (i.e., attempting to implement) until I get further along in C++ or is it something that one can start to dabble in as "advanced beginner" (which I think I'm at least getting close to now).

  2. #2
    C++まいる!Cをこわせ!
    Join Date
    Oct 2007
    Location
    Inside my computer
    Posts
    24,654
    Graphical user interfaces actually has nothing to do with C++ at all. C++ is a language for making programs, not user interfaces.
    So every C++ programmer needs a GUI framework or use some GUI API.
    There are several free C++ frameworks for GUI out there, wxWidgets being one I know of.
    As for API, Windows exposes Win32 API that allows you to create GUI, but it's C-oriented, so it's difficult and time consuming to use.

    Whichever way you want to use is up to you. I would recommend a good framework, however.
    Also know that GUI programming is not always easy, so be prepared for some frustration until you get hang of it.
    Quote Originally Posted by Adak View Post
    io.h certainly IS included in some modern compilers. It is no longer part of the standard for C, but it is nevertheless, included in the very latest Pelles C versions.
    Quote Originally Posted by Salem View Post
    You mean it's included as a crutch to help ancient programmers limp along without them having to relearn too much.

    Outside of your DOS world, your header file is meaningless.

  3. #3
    Registered User Sharke's Avatar
    Join Date
    Jun 2008
    Location
    NYC
    Posts
    303
    You could always try learning the basics of the Win32 API, it's all a bit long winded but I've found myself able to create basic windows and buttons etc. The trouble is that there aren't really any books which cover Windows GUI programming using the Windows API and the online tutorials aren't exactly extensive. You can consult the official Microsoft documentation but it's not exactly beginner friendly. This is a good tutorial for the basics:

    Tutorial: Getting Started

    You can probably find more with Google.

    You might be better off trying something like wxWidgets, it's free and there's extensive documentation available on the wxWidgets website:

    wxWidgets

    I once dabbled in the Python wrapper around this - wxPython. It was reasonably easy to make a basic GUI and the good thing is they look platform native. I have a book for wxPython but I've never seen one for wxWidgets. Plenty of tutorials on the website though.

    If you're just looking to spruce up your console programs with a splash of color and basic ASCII graphics etc, as well as dealing with keyboard and mouse events, this is a good tutorial:

    adrianxw.dk Win32 Tutorials Home

  4. #4
    Weak. dra's Avatar
    Join Date
    Apr 2005
    Posts
    166
    If you want something more portable, have at look at Qt. I've toyed around with it in the past, and it's actually pretty straightforward. It's object-oriented, which I think makes creating GUIs easier to do, not to mention it's much simpler than native win32, although it too isn't all that bad.

  5. #5
    Registered User
    Join Date
    Dec 2006
    Location
    Canada
    Posts
    3,229
    I love Qt, too, but many people also swear by WxWidgets.

    If you are a beginner trying to choose one, I would just roll a dice.

    They are both well-maintained and supported GUI toolkits (although Qt does a bit more than GUI).

    They are both portable (you don't need to change your code to make it work on Mac OS X or Linux for example), unlike Win32 API.

    [edit]
    They both require some fairly thorough understanding of C++, though.

    But I guess it can't hurt to give them a try. If you then find yourself have no idea what they are talking about, just put them aside for now, and learn some more C++ (for Qt, mostly OOP stuff. Not sure about WxWIdgets).
    [/edit]
    Last edited by cyberfish; 05-30-2009 at 01:13 AM.

  6. #6
    Registered User Sharke's Avatar
    Join Date
    Jun 2008
    Location
    NYC
    Posts
    303
    If I were using QT I'd be worried that I would inadvertantly create something worth releasing. What does a commercial license run to, $1600 or so? Then again, it does produce smaller, more efficient executables apparently.

    I think wxWidgets is a lot simpler. I found I could read some basic sample code and work out a lot of how it works without reading any explanation.

  7. #7
    Registered User
    Join Date
    Dec 2006
    Location
    Canada
    Posts
    3,229
    If I were using QT I'd be worried that I would inadvertantly create something worth releasing
    Under the GPL, yes .

    Qt has gotten LGPL now, too.
    Qt Licensing — Qt - A cross-platform application and UI framework

    Unless you want to modify Qt itself and not share your customizations, you can use Qt in proprietary applications free of charge.

    I believe WxWidgets uses a LGPL-like license, too.

  8. #8
    Registered User Sharke's Avatar
    Join Date
    Jun 2008
    Location
    NYC
    Posts
    303
    Quote Originally Posted by cyberfish View Post
    although Qt does a bit more than GUI
    As does wxWidgets - it comes with a whole bunch of non-GUI classes which provide advanced string handling, sockets, containers etc.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. dual boot Win XP, win 2000
    By Micko in forum Tech Board
    Replies: 6
    Last Post: 05-30-2005, 02:55 PM
  2. SDL and Windows
    By nickname_changed in forum Windows Programming
    Replies: 14
    Last Post: 10-24-2003, 12:19 AM
  3. IE 6 status bar
    By DavidP in forum Tech Board
    Replies: 15
    Last Post: 10-23-2002, 05:31 PM
  4. Manipulating the Windows Clipboard
    By Johno in forum Windows Programming
    Replies: 2
    Last Post: 10-01-2002, 09:37 AM