Click here to Skip to main content
11,412,302 members (60,436 online)
Rate this: bad
good
Please Sign up or sign in to vote.
See more: C++ Windows GUI
Hai Every one,
Presently i am developing windows projects in VB.NET. I am looking to develop GUI's in CPP domain.
Can any one help me to do this.
Even i don't have any Development tool.
Plss suggest me any development tool.

Thanks in ADV.
Posted 28-Jun-12 21:48pm
Comments
Sergey Alexandrovich Kryukov at 29-Jun-12 2:59am
   
Why C++? Or is it C++/CLI? How to write -- not a valid question. Want us to write a book on UI development? Right in quick Questions & Answers? :-)
--SA
Himachandra at 29-Jun-12 3:12am
   
Helloww Mr..
I need help with directions....
I'm not asking you to write a book
I am asking that for doing this give me some direction.
Don't misunderstand . . . .
If you don't know abt cpp... sit calm
enhzflep at 29-Jun-12 3:44am
   
Ha, ha, ha, HA!
If SA didn't know about C++, he certainly wouldn't have amassed 5/8 of the points you've gathered in the past year, IN THE PAST 24 HOURS.

:ROLL-EYES:
Albert Holguin at 5-Jul-12 18:54pm
   
As you can see by the responses, you have quite a lot of choices, I'd recommend trying out a few once you get good at C++... then making up your own mind as to what's easiest to work with and gives you the most desirable result. Once you become an advanced user, you'll find there's shortcomings in pretty much any solution that you'll have to provide your own solution for.
shelby67 at 6-Jul-12 2:25am
   
Book Options:
Sam's Teach Yourself C++ in 24 Hours ( http://www.amazon.com/Sams-Teach-Yourself-Hours-Edition/dp/0672315165 )
Ivor Horton's Beginning Visual C++ 2010 ( http://www.amazon.com/Ivor-Hortons-Beginning-Visual-Programmer/dp/0470500883 )


IDE options:
Dev C++ (old, outdated, and will never be updated, great for console, Win32 GUI)
Visual C++ 2010/2012 Express: (honestly the best out there, clean interface,needs some work on Intellisense features)
Turbo C++ 3.0 (really old school. 1993 release year. compatability issues)
CodeBlocks IDE (I avoid using this personally but others find it fine)

Here's my take on C++.
C++ is like a dumber version of C#/VB .Net. I have to use a different mind set when programming in C/C++ because you don't have as much documentation most of the time, lack of libraries and sometimes Intellisense in Visual Studio.
pasztorpisti at 9-Jul-12 18:40pm
   
I would't code in anything other than Visual C++ with a Visual Assist X plugin. You will need a non-express version of Visual C++ because express doesn't allow you to load plugins/addons but you should definitely try that plugin if you haven't done it already!!!
Pranit Kothari at 6-Jul-12 6:00am
   
I am not sure your question is good or bad, but it gave chance to read good views of many people.
Sergey Chepurin at 7-Jul-12 5:25am
   
I think this is a perfectly legitimate question for a beginner C++ programmer. This is kind of question you will not find an answer on Wikipedia or searching Internet. The number of people interested (>400 in a week) and the number of answers speak for itself.
Rate this: bad
good
Please Sign up or sign in to vote.

Solution 5

This seems a perfectly reasonable question. If you are already using Visual Studio then you have the IDE already. If not then you can get a copy of Visual C++ Express from this Microsoft site[^]. There are sample templates within VS to get you started, and there are articles here[^] on CodeProject to give you even more useful ideas. However, as Sergey Alexandrovich mentions, you really need to get a book on C++ to learn properly.
  Permalink  
Rate this: bad
good
Please Sign up or sign in to vote.

Solution 9

If you need a short answer: There is no fine solution. I used a lot of gui libraries extensively (in many languages), and the best would be a not too heavyweight widget based library without hacky solutions. There is no really good, clean solution for C++ unfortunatlely.
First, what is a widget based system??? I give this honours only to a gui library that uses object oriented design. Every control every panel, and every window is an object. In optimal case all you do is creating widget objects and setting their properties. Even building a gui hierarchy is just about setting the 'parent' property of the widgets. MFC and its friends are not widget based, and to make things worse, they are built on top of the heritage of low level win32 api solutions like dialog resources, and they are adding their own non-object oriented cr*p to the C winapi. These are so outdated solutions!!! Not to mention that its impossible to make such a program portable!!! (proting dialog resources???) If you are new to gui programming on win32, you have 2 choices. You can learn the the low level winapi + dialog resource stuff, and maybe later you learn MFC that builds on top of that, or you learn building gui with a nice widget based system. Using a well designed widget based system will eliminate a lot of bugs from your program, you will be able to build nicer guis faster, and usually a program based on a widget based system is much easier to make crossplatform, and its easier to change the gui system later. If you don't wanna build heavily size-optimized small executables (4k intro Big Grin | :-D ) and you are not that interested in the gui related winapi, then you dont have to learn it and definately go on with learning about widget based systems.

The C++ gui library that is the nearest to my expectations is Qt, but that library is heavyweight (I'm detailing it below) and uses code generator, its special syntax and its solutions might be very complex for a C++ beginner.

MFC: Terrible API, not even fully C++ style (not a widget based one). It has lots of methods which have the same name as the underlying wrapped winapi, but with different parameters. This confused me when I started MFC despite the fact that I was very good at creating gui with winapi. The poor api gives so complex solutions to simple problems (like splitters) that you can't memorize it even after years, you have to search the net and copy paste it right into your code every time. Resizable controls and dialogs need extra effort and helper libraries (you found some on codeproject). The gui you create with this can look nice windows native if you dont use a lot of cheap poorly designed custom controls.
wxWidgets: My opinion is nearly the same as about MFC, its a crossplatform MFC with some extra sh*t added to keep the stuff crossplatform. Note that MFC isn't only a pure gui library, its a big application framework that provides a lot of helper classes for other problems too (networking, file management, ...) but I don't recommend getting used to those helpers if you want to create crossplatform code.
C++/CLI: The .Net gui builder is nice and widget based. Haven't mixed c++ and .net yet, but iam agains heterogenous systems. One of my friends used .net to create gui for a c++ project and it was a big mistake with regrets. Debugging problems, slow UI, lots of bugs because it takes some time to get used to the common mistakes ppl make when they start using the gate between C++ and cli. Longer learning curve because you have to use 2 languages - the extra learning complexity is true even if you use C++/cli. .Net has very nice UI editor that uses anchoring to provide resizable layout (my favorite general layout mechanism), so this option seems to be an attractive one at first, but it has a lot of drawbacks. Visual basic, .net, and delphi use very similar nice gui building systems. Someone should have made one for c++, but noone started doing it. It would be completely possible by using the same workflow as JFormDesigner for java swing.
Qt: Widget based. Has a similar rapid ide as .net and delphi but I never liked its layout mechanisms and the controls that look native on neither operating systems. It has a signal-slot mechanism (a hyped and totally unnecessary feature) to send events between objects (events like button clicking), I never found out why is this better than an event listener, but it at least makes necessary to use a code generator with Qt that I don't like. You write your gui code in c++ and before compilation you have to preprocess it with the qt code generator. I would also mention that Qt contains a lot of other not gui related helper libraries like MFC that make this quite a big bloat and heavy-weight (however this isn't always a problem in a pc program). A nice feature of Qt that some complex controls have data model (like in java swing) that is a big black box for a lot of ppl who haven't worked with modern gui libraries, but if I wrote a gui library I would use data models in every controls.

If you want to understand the underlying C winapi for gui programming, then buy "Buy Programming Windows by Petzold." as Aescleal recommended. Thats the best book to start out with general winapi and GUI programming in C. Its in C and not C++ because most of the basic winapi is pure C without c++ support, so you use it as C even from C++. Even if you use a complete C++ library for some kind of stuff, its good to know the underlying C winapi that you library uses. This will be useful when you want to start writing your own rapid gui development tool for C++. Big Grin | :-D I should start writing one based on the best practices of Delphi, swing and JFormDesigner, but I just dont want to sacrifice my time for it.

EDIT: My bad, I mentioned JBuilder instead of JFormDesigner. Big Grin | :-D *corrected*
Added some explanation about widgets. What do I consider a widget?

ANOTHER EDIT: Always forgot to mention C++Builder, that was the sibling of Delphi from Borland. If I'm right that product is still in development. It is driven by exactly the same IDE and gui library as Delphi! We just stopped using it because of its custom C++ compiler (we preferred VC++) that had crash bugs. We also had some problems with compiling some crossplatform libraries but that was a minor headache. Maybe they have fixed those bugs already. I'm not using it because I'm a VC++ fun (most libraries support this compiler) and because C++Builder is not crossplatform (at least it wasnt when I used it). Still, if you want to know what I mean on gui development definately check out either Delphi(objectpascal) or C++Builder!!! What I didn't like in Delphi that it had no typesafe containers (they already introduced generics) and another stuff I miss from the gui is that they should have a data model, at least in the complex controls (listview, tree, ...). The custom compiler is needed because of the built in gui serialization support and some other fancy stuff - like the object method pointers (delegates) that are used to handle gui events.
Another problem is that I don't know if you can use it for free currently. But if pricing isn't a problem and you can stick to windows and the compiler of C++Builder, then this is definately a very-very nice development and gui building environment on windows!!!!!!! Especially if you are writing database handling applications because it also has components and table controls that support that!
  Permalink  
v6
Comments
Stefan_Lang at 6-Jul-12 11:37am
   
If you need a short answer...
Maybe you should rethink your introduction ;o)

P.S.: ok, maybe I misunderstood the following sentence - did you mean that introduction to be an excuse for a long response? Fair enough, then.

Anyway, some very useful advice. But if I understand you correctly you don't like either solution? I'm not going to disagree: I would have thought QT or wxWidgets to be good suggestion, but I never got around to actually do a project with either. And I don't like the alternatives...
pasztorpisti at 6-Jul-12 12:31pm
   
Caught me! ;D You pointed out well, I don't like either solutions in C++. If I had to start a gui project in C++, I would be in trouble! :D MFC is terrible, a definite no-no (I would rather write a small framework for myself on top of winapi - just kidding :D), and the same is true for wxWidgets that copies the methods of MFC. I know that wxWidgets is a very popular (and overly hyped) framework, but I think most ppl use it because of the hype around it, and because they started to use that (and they already know its api) because one of their friends used and recommended that....... :D And because there were no free alternatives for crossplatform "C++" gui libraries that time. This was enough for wxWidgets to spread. Lot of MFC/wxWidget coders ususally have only shallow knowledge about the alternatives, this is why some coders like (and recommend blindly) these so much. I would probably choose Qt again, but that isn't perfect either. There are some really good design decisions in the gui libraries out there, someone should just merge them into a c++ gui library...
Stefan_Lang at 9-Jul-12 4:15am
   
I would rather write a small framework for myself on top of winapi
If the two of us ever happen to get caught in 'groundhog day' ( http://en.wikipedia.org/wiki/Groundhog_Day_%28film%29 ) then I'll gladly join you on that project ;-)

Luckily I've never had to program a GUI over the past ~15 year, so this isn't a problem I had to deal with recently. But due to my very bad experience before then I still keep watching out for better frameworks. I suppose if I had to choose a framework today, QT would be the first to check out. But I do hope that by the time this happens there will be something better around...
pasztorpisti at 9-Jul-12 18:34pm
   
Lol, this is a nice film! :D
There is a txt file somewhere on my hd with a list of my expectations from a gui library. Someday those dreams should come true but now I don't have the time for it unfortunately. I believe that even a marketable competitive product could be created with a few months of work.
Sergey Chepurin at 7-Jul-12 4:33am
   
Very good answer but to the person already experienced in GUI programming. "Unfortunately,
C++ does not provide a standard GUI library the way it provides the standard stream I/O library, so we use one of the many available C++ GUI libraries." (B.Stroustrup, "Programming: Principles and Practice using C++" Ch. 12[^])
Thus, C/C++ projects usually apply "lesser of two evils" GUI solutions available, either OS oriented, or cross-platform, commercial or free framework. But never C/C++ native one which does not exist.
pasztorpisti at 7-Jul-12 5:54am
   
Funny that Stroustrup mentioned that... Unfortunately they haven't dived into the golden principles of gui programming and haven't checked out the available solutions and their quality! :D I knew only assembly and a bit of c+pascal (and win16 gui programming that is near to win32) when I started out gui programming on win32 in delphi. Didn't even know what object oriented programming is! (Ironically delphi thought me that in 1 year before I found a book on the topic.) I could still create wonderful user interfaces in no time without hassle! (With resizable dialogs/splitters and the like - even on dialogs - that count as wonder in MFC!!!) This is the power a good gui library and good tools. Just started delphi, did a few clicks wrote a few lines of code and pushed the magic button to start the prog. JUST BECAUSE OF THE NICE TOOLING currently Qt is the nearest to that, still far away because I just don't like the solutions to some basic problems and the bloat that is around the library.

PS: With a nice gui library + toolset, you shouldn't be that experienced in gui programming to create an acceptable basic gui!
Sergey Chepurin at 7-Jul-12 6:36am
   
In my opinion, "acceptable basic gui" you can create in Windows API + resource editor (this simple solution is actually quite often accepted in scientific or industry oriented not commercial applications). The problem is that for commercial "from-the-shelf" programs you have to propose something special or even fancy like mobile phone apps (at least that is what i see everyday). That is where some talent and design plus programming skills are required.
pasztorpisti at 7-Jul-12 11:33am
   
Sure, if you don't have lots of gui and there's no need for crossplatform solution winapi+res is the best, iam also going with that sometimes. Mobile phone gui is another stuff, but I dont think that it requires more progamming skills. The android java api is much easier to use that the stupid c++ solutions on PC. On iPhone you have to fight with objective C that has unfortunately survived :P But learning another language is not a big deal. There the problem is that you have to make overly simple gui that works on a lot of screen resolutions. That isn't a problem if all you provide is some "input forms"/buttons but it is probably a horror if you want to properly support tablet resolutions too. XD And the real big horror is when you have to be crossplatform on mobile (android, iOS), thats what we are doing currently and that sucks despite the fact that we have minimal gui code!
Rate this: bad
good
Please Sign up or sign in to vote.

Solution 10

Take a good look at C++Builder XE2[^]

This product is fun to work with, and the visual designer is very good.

You'll be able to create working programs just as fast as you are able to do it in VB.Net.

Best regards
Espen Harlinn
  Permalink  
Comments
pasztorpisti at 9-Jul-12 19:08pm
   
+5 This is the best if someone wants REALLY RAPID C++ development on windows that involves a lot of gui development. Companies usually use Delphi and C++Builder to build thick clients for multitiered database systems but that is far not the only use of these gems!
EDIT: I have seen that they made this work on OS X. That is awesome! User opinions about that? Do they plan to port it to Linux like they tried Kylix with Delphi???
Rate this: bad
good
Please Sign up or sign in to vote.

Solution 6

Bjarne Stroustrup has said that the biggest mistake that programmers make is trying to learn C++ at the same time as learning how to program a GUI. Writing win32 GUI apps in C++ can cause an unholy mess if you don't understand the programming language or the environment you're using.

First off I'd really heavily suggest you get hold of either Accelerated C++ by Koenig and Moo if you're an experienced programmer in a couple of languages or Programming -- Principles and Practice Using C++ by Bjarne Stroustrup if you aren't. Stroustrup's book has some GUI programming in it using an off the shelf class library which may be of some benefit to you even if you are an experienced programmer. Work through one or both of those and you'll be up to speed with C++.

There are two ways of programming Win32 apps in C++:

- Use the Win32 API. It's very low level and takes a while to get your head around
- Use a class library. They're usually fairly high level and take a while to get your head around

In either case grab a copy of "Programming Windows" by Charles Petzold, a reference to the Win32 API for C programmers. It's a must even if you never intend to call a Win32 function in your entire programming career as it shows you the structure of Win32. Even if you vote for using a class library then it's good as it shows you what your class library is hiding.

If you go for a class library then you've got loads of choices. Three (of many) are:

- MFC - it's a bit long in the tooth and not written in modern C++. It comes free with Visual Studio Pro and more expensive versions.

- WxWidgets - originally a cross platform attempt at MFC so it has many of the advantages and disadvantages of MFC with the bonus of write once, run anywhere.

- Qt - last time I looked (and this was over 4 years ago) it used several tools to effectively extend C++ to an extent I didn't particularly like - they weren't needed. From what I've heard (but not experienced) these have been removed and if that's true I could see it being a great platform to develop on.

To compile your code I'd suggest Visual Studio Pro (don't bother with the more expensive versions, they're not designed to support solo efforts) if you can afford it or the MinGW version of g++ (the GCC C++ compiler). If you go for MinGW you can take MFC off your list of possible class libraries.

So the TLDR version:

- Buy, read and inwardly digest a good book on C++. There's only a couple so be careful you don't waste cash and time. If it's got the name Herb Schildt on the cover please run for a can of petrol and a match and do the world a favour.

- Buy Programming Windows by Petzold.

- Try and choose a development environment - either Win32 or some sort of wrapping class library. You can see which ones appeal by downloading some sample code in each and seeing which one suits your style
  Permalink  
v2
Rate this: bad
good
Please Sign up or sign in to vote.

Solution 4

Use Qt [^]

Qt applications run both on Windows and Mac; and Linux. Plus, it is free (see conditions on that site).

Look at [^] for getting started.
  Permalink  
Comments
Gevorg Hai at 30-Jun-12 9:51am
   
Qt is really very good choice !
Rate this: bad
good
Please Sign up or sign in to vote.

Solution 7

If you come from VB.NET, then, i suppose, you just start to program in C/C++.
- The easiest way to create C/C++/Win32 GUI applications on Windows is by using Visual C++ Express 2010 (free, and probably last free C++ IDE from Microsoft, so get it now) + ResEdit[^](resource editor to add simple controls in your applications - ListBox, Edit Box, ComboBox, ListView, etc).
Then come professional GUI frameworks:
1. MFC - comes only with retail versions of VC++ and is considered outdated by many.
2. Qt - very feature rich, cross-platform and free framework, but big and not easy to learn for a beginner. Though, knowing Qt will add some points in your resume, for sure.
3. WTL - light-weight free GUI framework from Microsoft. But lacks documentation and not supported.
4. Some other less popular frameworks, including WxWidgets.
Be aware, that comparing to .NET IDEs, all these frameworks (except MFC) require some effort to install and to tune it for your needs (also, not an easy for a beginner C++ programmer).
  Permalink  
v2
Rate this: bad
good
Please Sign up or sign in to vote.

Solution 2

  • Get Code::Blocks with MinGW
  • Get ResEdit.

Inside Code::Blocks,

File->New->Project, Win32 GUI Project, Frame based. Give project a name.

Fit F9.


Or, there's always Visual Studio - which you've clearly got, since you're writing VB.NET code.
  Permalink  
Rate this: bad
good
Please Sign up or sign in to vote.

Solution 1

How about Visual Studio Express, free of charge? Please see:
http://en.wikipedia.org/wiki/Visual_Studio_Express[^],
http://www.microsoft.com/express/[^].

—SA
  Permalink  
Comments
Himachandra at 29-Jun-12 3:12am
   
Helloww Mr..
I need help with directions....
I'm not asking you to write a book
I am asking that for doing this give me some direction.
Don't misunderstand . . . .
If you don't know abt cpp... sit calm
Sergey Alexandrovich Kryukov at 29-Jun-12 3:27am
   
OK. You are reported for your rudeness. I provided you proper information, thought you could use it. I don't think you understand what are you talking about. Directions... Directions on developing UI is a book. You did not even bother to explain what type of UI are you interested in: WPF? Forms? Silverlight? ASP.NET? Metro? GTK+? MFC? Something else?
--SA
enhzflep at 29-Jun-12 9:26am
   
Easy Tiger!
You have a highly detailed and enviable knowledge of many things related to programming. It is however the comments that you leave occasionally that leave me thinking: "страдающий манией величия" (megalomaniac for English speakers)

The original post is unedited, the tag clearly states C++. How the elephant is Silverlight or ASP.NET relevant?
Sergey Alexandrovich Kryukov at 29-Jun-12 17:55pm
   
Not at all. I don't have a single reason to have such kind of mania, just because there is nothing I could really be proud of. I just don't like rudeness. Anyway, thank you for your comments.

Now, to answer your question: the point is: Silverlight and ASP.NET are not much related, but they are different kinds of UI. As the question about UI programming is way too broad, perhaps pointing out just one application type first would make the question more realistic. Was there any other way to understand my note about different kinds of UI above?

Thank you.
--SA
Himachandra at 29-Jun-12 3:40am
   
I don't need suggestions from you......
Sergey Alexandrovich Kryukov at 29-Jun-12 3:46am
   
Do you want me to apply your candidacy for banning from this site? You don't have any shame.
Is it you who anonymously voting 1 to my posts?
--SA
Himachandra at 29-Jun-12 5:49am
   
Not a prob for mee.......
I don't want to stay this sort of *****
If you have capacity to ban me from this site...let bannn.......
I have self confidence to resolve my problemsssssss....
U don't have right to discourage any person with your post
idle63 at 1-Jul-12 15:36pm
   
Take it easy. At the beginning I had also my "problems" with the comments of SA. But with time I realized that he is very professional. Now, I go a lot of time to see his answers, simply to learn... Regards
Albert Holguin at 5-Jul-12 18:56pm
   
Ask and you shall receive... suggestions from all users in this case... don't take things personally. SA is a tough cookie but he's also a smart guy. Cheers
Sergey Alexandrovich Kryukov at 6-Jul-12 1:15am
   
Tough? I don't want to tolerate when someone tells me "if you don't know... sit calm". Did you notice that?
--SA
Albert Holguin at 6-Jul-12 10:49am
   
I did notice that... but to be quite honest, you are building a quite a rep on the site already, so don't be surprised if people are defensive to your posts off the back.
Sergey Alexandrovich Kryukov at 11-Jul-12 16:07pm
   
Defensive..?
--SA
Albert Holguin at 11-Jul-12 17:18pm
   
As in, start to react bad to any comment you make off the back regardless of context (i.e. defensive to any criticism).
Himachandra at 18-Jul-12 2:37am
   
You are exactly correct
Rate this: bad
good
Please Sign up or sign in to vote.

Solution 3

use MFC..the sweetest of the development platform for windows environment..
  Permalink  
Comments
Aescleal at 30-Jun-12 9:01am
   
Sorry old son, I can't share that opion. MFC might have been good 20 years ago but these days it's a complete behemoth that should have been put down.

If you'd like to revise your answer to something like: "Look at MFC, it can speed up the development process for windows apps and I really enjoy using it" then I'll crank up my 1 to a 4 or 5.
Albert Holguin at 5-Jul-12 18:49pm
   
That's more of an opinion on it.... some people hate Qt... [to clarify, not necessarily a bad opinion, but an opinion nonetheless]
stib_markc at 6-Jul-12 6:50am
   
I think MFC is easier to learn and excellent documentation is provided. I am a beginner, so to start off with MFC is good, but I am trying to shift to Qt, because I see Qt being advised by many, for GUI programming. But I find MFC comfortable, may be because I have been working from the past 1 year with it.
Albert Holguin at 6-Jul-12 10:54am
   
The documentation for MFC is really pretty darn good... Qt has the benefit of being cross platform but it's built differently than MFC so there will be a bit of a learning curve.
stib_markc at 6-Jul-12 23:53pm
   
Exactly, that is the reason, I am shifting to Qt, so that more opportunities will open up for me.
Rate this: bad
good
Please Sign up or sign in to vote.

Solution 8

Use C++/CLI. It will be easy for you, coming from VB. I think any Visual Studio with VC include it.
From C++/CLI you can use native standard c++ too (but with some interop effort). Or fully switch to native c++ using one of the already mentioned lib.
  Permalink  
Rate this: bad
good
Please Sign up or sign in to vote.

Solution 11

C# is your best choice. .....
  Permalink  

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS
0 OriginalGriff 348
1 Sascha Lefévre 175
2 ProgramFOX 130
3 Maciej Los 110
4 Sergey Alexandrovich Kryukov 105
0 Sergey Alexandrovich Kryukov 8,980
1 OriginalGriff 7,263
2 Maciej Los 3,500
3 Abhinav S 3,248
4 Peter Leow 3,059


Advertise | Privacy | Mobile
Web02 | 2.8.150414.5 | Last Updated 7 Jul 2012
Copyright © CodeProject, 1999-2015
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100