Hello,
I am new to make programs. So far I can just do logical stuff like math in a dos window. I now want to move on to making actual windows programs. Does anyone know how to make a GUI in C++ for a windows application? Any reading online or in a book that I can look up? And I was also wondering once you have your code and your GUI how to make the code become the program?
Any help would be great,
Thanks

Recommended Answers

All 28 Replies

Hello,
I am new to make programs. So far I can just do logical stuff like math in a dos window. I now want to move on to making actual windows programs. Does anyone know how to make a GUI in C++ for a windows application? Any reading online or in a book that I can look up? And I was also wondering once you have your code and your GUI how to make the code become the program?
Any help would be great,
Thanks

http://www.winprog.org/tutorial/ -- That will teach you how to make a GUI for Windows only in window's native GUI implement (API)

To implement your code you need to respond to a user's action, i.e clicks a button then do i = 1+1;

the definitive book to pick up would be charles petzolds "programming windows"

It's easy once you get to know the windows message handling
[I will assume you checked out http://www.winprog.org/tutorial/ it's good]

Hey read everything and if you need more come back here..

You cant compile GUI like dos, you will have to change some options in your compiler or you will get an error on make like:

WinMain() not referneced ..... bla...bla or someting like that

Yeah I read most of the tutorial and havent got a cahnce to finish it yet. I heard that using a library would be an easier way of making a GUI so I found one called fox-toolkit. The only problem is that I dont know how to get it to work or install.
Right now I am using Bloodshed Dev-C++

Dump the fox-whatever.There are alot of such stuff which have no future. Get rid of Bloodshed also.I have used it and some standards are not supported.Borland Command line complier (they give that for free) is much
better.

Window's native GUI implement (API) is also good to know it's not so tough.

That wasn't very helpful. And the new version of Dev-C++ is pretty good.
I still need to know how to install a new library if any one could help. I know that the library is intergrated into the API to make it easier.

If the library is integrated into the API, then you shouldn't have to install it.

...What GUI library are you trying to install, anyways? There are bunches of them: Gtk, Qt, and Motif are examples of GUI libraries-- what's the name of the one you're trying to install?

Dump the fox-whatever.There are alot of such stuff which have no future. Get rid of Bloodshed also.I have used it and some standards are not supported.Borland Command line complier (they give that for free) is much
better.

What don't you like about bloodshed? I have used it a bit and quite like it, I prefer it over Visual C++ 6, and so far as standards are concerned it is basically GNU GCC 2.95 (last time I checked) ported to windows which is very standards compliant.

Its called fox-toolkit. I got it from their website at www.fox-toolkit.org. I tried to get Gtk but it wouldn't let me download it from the site. If you know where i can get it that would be great. Thanks.

I have tried to install the gimp tool-kit before and it did not work, I think i was installing it wrong. How do you do it?

Download the BCX system from:

http://www.rjpcomputing.com/programming/bcx/devsuite.html

It's free, creates C or C++ code you can look at and learn from. Super help file and lots of GUI samples. Look at BCX as a preprocessor. I use it all the time, a great learning tool.

Dude my advice would be to go to C# instead..C++ is for rough programming..It would help you more if you were aming to program in other platforms like Linux for example..But if you want to program in Windows the best way to fo is C# and the good news is that C# is also supported in platforms like Linux..I believe there is a library that lets you do this. The name is Mono and there is a very easy to learn library to create your gui called gtk-sharp..You can even use XML to create a gui..But anyways if you want to give C# a try do the following..

Go to C:/WINDOWS/Microsoft.NET/Framework/[Find Version 2]
Then find a program named csc.exe (That is a CSharp compiler shipped with .NET Framework)
Create a batch file in your Desktop named CS.bat
Add the following commands to it change the Version number between the brackets

path C:/WINDOWS/;C:/WINDOWS/System32;C:WINDOWS/Microsoft.NET/Framework/[Version 2]
cls

The create a source file to test this out here is the code make the name Test.cs

using System;
using System.Windows.Forms;

class Test {
                  
                 static Form frm1;

                 public static void Main(String[]Args)
                 {
                                   frm1 = new Form();
                                   frm1.Text = "Test Window";
                                   frm1.Show();
                                   MessageBox.Show("This is my first C# Program and Window");
                                   Application.Run();
                 }
}

Yeah then you have to compile it so Open a Command Prompt window and do this

cd Desktop
CS
csc /t:winexe /r:System.Windows.Forms.dll Test.cs
Test

Wallah there you go man you see how easy you should try it..

Hello,
I am new to make programs. So far I can just do logical stuff like math in a dos window. I now want to move on to making actual windows programs. Does anyone know how to make a GUI in C++ for a windows application? Any reading online or in a book that I can look up? And I was also wondering once you have your code and your GUI how to make the code become the program?
Any help would be great,
Thanks

Also try MFC(Microsoft Foundation Classes). It is an encapsulation of Windows API. To make them work just compile, build and execute the ordinary way!. As easy as that(You can even skip compile:) ).

Also try MFC(Microsoft Foundation Classes). It is an encapsulation of Windows API. To make them work just compile, build and execute the ordinary way!. As easy as that(You can even skip compile:) ).

I agree MFC is pretty easy to use, but it isn't free. Neither VC++ 5.0 Express nor VC++ 8.0 Express supports it. If you want to use MFC then you have to buy the Stanrard or better versions for $$$$.

VC++ 6.0 should be scrapped for the newest Express version because of compatability problems.

Wonderful tutorial, I thank you very much. I've been doing C++ for 2 years now (school) and I've only done logic programming.

The guy asked for advice on _C++_ GUI programming. You say "C++ is for rough programming"? What does that mean? C++ is very well suited for GUI programming.

Anyone else interested in C++ GUI programming, look into gtk, Qt, or wxWidgets and there are others.

I know C# and I'm not trying to be critical of it but my advice in evaluating your options when starting a project is to look at portable options and work from there with consideration for the requirements of your project and if you end up choosing C#, that's fine. There is Mono to make C# a bit more portable but there are still issues there. Personally, C# would not be a starting point for me in choosing my options for most of my projects.

You suggest gtk-sharp as an option. You then have gtk in C++ or C# (among others). At this point you should be considering your language by it's suitability to your project.

Dude my advice would be to go to C# instead..C++ is for rough programming..It would help you more if you were aming to program in other platforms like Linux for example..But if you want to program in Windows the best way to fo is C# and the good news is that C# is also supported in platforms like Linux..I believe there is a library that lets you do this. The name is Mono and there is a very easy to learn library to create your gui called gtk-sharp..You can even use XML to create a gui..But anyways if you want to give C# a try do the following..

Go to C:/WINDOWS/Microsoft.NET/Framework/[Find Version 2]
Then find a program named csc.exe (That is a CSharp compiler shipped with .NET Framework)
Create a batch file in your Desktop named CS.bat
Add the following commands to it change the Version number between the brackets

path C:/WINDOWS/;C:/WINDOWS/System32;C:WINDOWS/Microsoft.NET/Framework/[Version 2]
cls

The create a source file to test this out here is the code make the name Test.cs

using System;
using System.Windows.Forms;

class Test {
                  
                 static Form frm1;

                 public static void Main(String[]Args)
                 {
                                   frm1 = new Form();
                                   frm1.Text = "Test Window";
                                   frm1.Show();
                                   MessageBox.Show("This is my first C# Program and Window");
                                   Application.Run();
                 }
}

Yeah then you have to compile it so Open a Command Prompt window and do this

cd Desktop
CS
csc /t:winexe /r:System.Windows.Forms.dll Test.cs
Test

Wallah there you go man you see how easy you should try it..

@ those who aren't already using any version of Microsoft Visual Studio:

You n00bs... Why do you continue to you use third party compilers? If your even remotely into development, you all need to get Microsoft Visual Studio. If on *nix machines, get WINE, and then get MSVS. MSVS is by far the best development workstation for any developer. And for the love of god, don't f***ing complain about it costing too much money. <snipped URL>
And if your one of those 'ethical' people who are religously banned from downloading illegal torrents, get a job, and use your second paycheck to buy MSVS.

~T3chn0logic

commented: Go away.. +0

First of all reading the thread has been very nice. I've been trying to avoid working with gui's for quite a while now, but they're tending to catch up to me. Thank you for the link to the tutorial, because it just makes it that much easier to figure this stuff out.

@ those who aren't already using any version of Microsoft Visual Studio:

You n00bs... Why do you continue to you use third party compilers? If your even remotely into development, you all need to get Microsoft Visual Studio. If on *nix machines, get WINE, and then get MSVS. MSVS is by far the best development workstation for any developer. And for the love of god, don't f***ing complain about it costing too much money. <snipped URL>
And if your one of those 'ethical' people who are religously banned from downloading illegal torrents, get a job, and use your second paycheck to buy MSVS.

~T3chn0logic

and T3chn0logic, dude, chill out. Your post and my post here really have no bearing on this thread. But if you will consider this, the only thing that really matters when developing software is how you or your client wants it to run. Microsoft products are not the end all solutions for development. If you really consider what you are using for programming, then using something like MSVS, Eclipse, Scite, Dev-C++, Vi, Emacs, or Jed are just tools. None of these programs are final solutions for development platforms for all people. They are simply different programs that different people find effective to use. Sure MSVS has a proprietary compiler, but it depends on the program's intention and the programmer as to which compiler is a good choice.

Keep in mind you can still use .NET on Linux/Mac/Windows with Mono. ;)

@ those who aren't already using any version of Microsoft Visual Studio:

You n00bs... Why do you continue to you use third party compilers? If your even remotely into development, you all need to get Microsoft Visual Studio. If on *nix machines, get WINE, and then get MSVS. MSVS is by far the best development workstation for any developer. And for the love of god, don't f***ing complain about it costing too much money. <snipped URL>
And if your one of those 'ethical' people who are religously banned from downloading illegal torrents, get a job, and use your second paycheck to buy MSVS.

~T3chn0logic

You're the n00b here ;)
MSVS is alright, but there is no best compiler.

Try Ultimate++ RAD suite (it's free; MinGW compiler in bundle):

http://www.ultimatepp.org/

I hope, you will get your first GUI application (almost) at once after download and installation...

Hi, I am Rammohan from Bangalore and working as a Technical lead in big IT firm . Solution for your answer is follows:

Depends on your requirements you need to select the compiler.
Once the compiler selection is over then 50% of the job done.

Based on your compiler you need to change or write your way of C++ code towards the problem solving direction.

I believe you know TurboC compiler. By using this also you can make Graphical design application. But it will work for only on DOS.

If you want to run your graphical application on windows then you can choose any one of the following compiler.

Microsoft VC++
Borland C++


After selecting the compiler you need to go for the GUI tools which are freely available on the net.
Skin Crafter is a evaluation tool and which will allows VC++ developers to easily customize MFC-based applications with professional GUI skins. Click here (http://www.skincrafter.com/) to learn more in this tool.
In the above tool you need to write the code and later you need to modify abased on the skin selection form the tool.

If you don’t want to write any single line code and you want to create drop and drag method way to create any GUI application by using Caretta . Create User Interface Designs And Interactive Prototypes In 3 Easy Steps Without Writing A Single Line of Code. Trail version is available under http://www.carettasoftware.com.


UCanCode E-XD++ is also tool and which will creates graphical applications for you...

Go through the following link for sample code for the GUI applications based on C++:
http://www.codejock.com/

And finally I can give you few tutorials links for further approach:
http://www.winprog.org/tutorial/
http://www.functionx.com/win32/index.htm
http://catch22.net/tuts/

http://www.gametutorials.com/

Those were the ones I've used to learn. If you're interested in creating games too, you can look into SDL and openGL. http://www.libsdl.org/

Wish You Good luck...
<snip fake signature>

You're the n00b here ;)
MSVS is alright, but there is no best compiler.

No, he's obviously right.
VS.NET has the best IDE, the best debugger and the best compiler.
All companies use it.

Yeah im looking at the http://www.winprog.org/tutorial/dialogs.html tutorial and its really good! Its helping me a lot! It has a huge list of things on the left side about Windows Programming and a bunch of GUI. I'd for sure recommend looking if that if you haven't all ready.

P.S I USE DEV C++ TOO, YOU GO TO NEW PROJECT, AND SELECT WINDOWS APP AND ALL ThE CODE ON THAT SITE WILL WORK IN IT!

lol. But yeah

http://fltk.org/index.php
Or the Irrlicht game engine has an easy GUI, but to some it's still more in the "to-do" sort-of phase.


P.S I USE DEV C++ TOO, YOU GO TO NEW PROJECT, AND SELECT WINDOWS APP AND ALL ThE CODE ON THAT SITE WILL WORK IN IT!

Can you please avoid the color red, or green in forums with white backgrounds. I can't see it that well. Plus "SHOUTING" with bold on, makes it a little worse.
Thank you, a personal request.

I think the best way to make GUI in C++ is XML.for GUI programming C++ is best place.winprog.org is helpful and easy.

Closing this thread to avoid further confusion.

Thread Locked.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.