Log in

View Full Version : is there a beginners guide for gui programming in c++ (visual studio)?


E-Male
2nd February 2005, 04:17
i think thet by now i can say i got some c++ basics
i can use files and parameters as input do stuff and ouput it to the command-prompt or a file
so far so good

now i tried to do something with a gui
my first plan was to do a window with just 3 text boxes, 2 to enter numbers in, 1 that shows there sum (so a very simple calculator)
i didn't get it done

after creatign a new project i got one with a menu to exit and to open an about box
and some code that looked confusing first, but i think i understand a bit of it by now

but i couldn't add anything to the main window
and when i tried some stuff in the about window (2 textboxes, one just copying the others content) i failed

so to come to the question:
is there some guide for gui-noobs online (no books pelase)?
some step-by-step for teh first cheap gui (like the one i tried)?
i think i'll learn fast, i just need some easy meterial to start with

thx for any help
E-Male

edit/p.s.:
i also tryed MFC, no luck either

the error that stopped me, on both tries is this:
IDC_EDIT2.value=IDC_EDIT1.value;
error C2228: left of '.value' must have class/struct/union type

dragongodz
2nd February 2005, 05:13
general gui creation etc.
http://winprog.org/tutorial/

tutorials on using MFC including using visual c++ appwizard etc.
http://devcentral.iftech.com/articles/MFC/default.php

E-Male
2nd February 2005, 05:37
thx, looks like what i looked for

EDIT: bookmarked the 1st link, should be enough to keep my busy for some time

Nic
2nd February 2005, 16:46
IDC_EDIT2.value=IDC_EDIT1.value

That would never work ;)
IDC_EDIT1 will be the resource ID value. To do something useful with it you could try (Use MFC) GetDlgItem(IDC_EDIT1)->ShowWindow(SW_SHOWWINDOW) <- If you wanted the window to be visible for example.

But what you really want to do is use MFC ClassWizard. And Learn to use UpdateData, etc. Codeproject.com is also a very very useful asset. But I'm sure the above links will help you anyway...

Cheers,
-Nic

Guest
2nd February 2005, 17:25
EEoooeeh. MFC? Are you serious, Nic? :o

E-Male
3rd February 2005, 00:36
http://winprog.org/tutorial/ had examples on exactly what i was looking for
i think unless something specific makes me trip i'll get though it and gather the information and experience i need to begin with

but thanks for the additional help

Nic
3rd February 2005, 10:52
@Neuron2: Well...If you're doing a windows only GUI and you want to do it easily. Then yes :) You've seen how it looks when someone codes a GUI with just the Win32 API...gui.cpp is a testament to that ;)

-Nic

P0l1m0rph1c
4th February 2005, 21:22
From my experience, I can say i prefer a lot using plain Win32 API, than having to use MFC. And it doesn't get that big, and you don't have to deal with weird C++ crap.

It's so much simpler using Win32 only,i think.

stax76
4th February 2005, 23:49
ATL might be a compromise (the real deal is CLR/SWF of course :D)

Doom9
5th February 2005, 01:31
well, MCF has the distinct advantage that you can use the VS GUI designer, and won't have to give 10 useless parameter to every method call ;) I don't know if there's a GUI designer for plain W32 API. And unless you need to create ActiveX components with a GUI, I'd stay away from ATL (I find it really ugly, but there's no way around it if you're doing DCOM).

I'm a regular visitor to codeproject.com, it has a number of tutorials that I found very useful (my DCOM server-client solution would have taken a lot longer without the DCOM tutorial over there).

Last but not least, if your target platform is Windows only (Visual Studio suggests that), and you're not dealing with a clientele that has a no tolerance policy on additional libraries (be it MCF, VB runtimes (ugh), or .NET) you might want to have a look at the .NET framework. It makes a lot of GUI work a lot easier. Microsoft is really pulling in the .NET direction and we'll see a lot more managed code with the next version of Windows.

diehardii
18th February 2005, 15:13
Hi,

I've found beginning visual c++ 6.0 by Ivor Horton to be very helpful in getting started. I use vs.net2003 and most of the code still translates. You have to use your noggin a bit, but that's probably good anyway. The first 8 or 9 chapters are essentially generic c++ (basic c, classes, inheritance, etc) and then some mfc (enough to get started), and then misc topics like dlls, activex, com...

I found this to be an invaluable reference when I was starting out. If you get stuck, you can find the answer to almost any question at codeguru.com. Good luck

~Steve

Guest
18th February 2005, 15:48
Originally posted by Doom9
well, MCF has the distinct advantage that you can use the VS GUI designer, and won't have to give 10 useless parameter to every method call ;) I don't know if there's a GUI designer for plain W32 API. You can use the Visual Studio GUI designer (resource editor) for plain Win32 GUIs. I do it all the time.

Those parameters are not useless if you're a pedal-to-the-metal kind of a guy. :D

Zephyrous
18th February 2005, 15:57
i would suggest 'Programming Windows', 5th Edition, by Charles Petzold
or if you want to go to MFC.. Jeff Prosise's 'Programming Windows
with MFC' become handy
http://www.charlespetzold.com/pw5/
http://www.microsoft.com/mspress/books/1431.asp