[RESOLVED] A few questions before i go too far
Hi.
Using WordPad and Borlands C++ Compiler 5.5
Im a web programmer by trade and Im currently learning C++. I have brought Herbert Schildts book: C++: A Beginner's Guide which is great. (At the moment) Im learning C++ really quickly and its all making sense!
However there are a few questions I have, which I hope someone can answer for me!? Ive searched various FAQs but cant seem to find the answers Im looking for!
Firstly (as Im learning the basics), all the programming Im doing is console based, as youd expect from a beginner. When Ive finished with this book I want to move to Windows programming, Im not too keen on using Visual C++ when I start doing so. The reason being is that I want to do it the hard way to pick up the fundamentals. Once Ive done that I dont mind what I use. Can anyone point me in the right direction to start learning (very basic) windows programming without a powerful IDE?
Secondly, (and ultimately) I want to develop an application with CRUD functionality (via windows & forms) that interacts with a database. (Although I do this on a daily basis on the web) with the C++ experience I have at the moment I have no idea where to start when it comes to database programming with C++. Again Id rather learn the simple tasks of database interactive without the use of an IDE to start with. Can anyone point me in the direction of a simple C++ database programming tutorial? Shedding any light on which database server to use would be handy too!
Thanks for any help!
Jon.
[1571 byte] By [
reeksy] at [2007-11-20 10:02:27]

# 1 Re: [RESOLVED] A few questions before i go too far
Hi.
Using WordPad and Borlands C++ Compiler 5.5
Im a web programmer by trade and Im currently learning C++. I have brought Herbert Schildts book: C++: A Beginner's Guide which is great. (At the moment) Im learning C++ really quickly and its all making sense!
However there are a few questions I have, which I hope someone can answer for me!? Ive searched various FAQs but cant seem to find the answers Im looking for!
Firstly (as Im learning the basics), all the programming Im doing is console based, as youd expect from a beginner. When Ive finished with this book I want to move to Windows programming, Im not too keen on using Visual C++ when I start doing so. The reason being is that I want to do it the hard way to pick up the fundamentals. Once Ive done that I dont mind what I use. Can anyone point me in the right direction to start learning (very basic) windows programming without a powerful IDE?
start with win32 API
go thru this link
http://www.relisoft.com/win32/index.htm
Programming Windows, 5th Edition (http://www.amazon.com/Programming-Windows-Fifth-Charles-Petzold/dp/157231995X)
:)
# 2 Re: [RESOLVED] A few questions before i go too far
From my experience I can tell that it was easier to learn it the other way round. Because the Win32 API is sometimes cumbersome and hard to understand I used VC 6.0 and MFC applications to start from. The first wizard-generated code contained much code I had no idea of what it was doing, but it worked. When I gained experience I dug deeper into the MFC code and learned that it was a Win32 wrapper and internally called Win32 functions. Charles Petzolds Windows Programming book was a great help to understand whats going on under the hood.
# 3 Re: [RESOLVED] A few questions before i go too far
With any book, I would recommand using VC++ as an IDE, even though it has features needed for a pro developer, a beginner should start with it, so that he can get time to adjust to it. If you are going to practice Win32 APi's first then you can very well use Visual C++ 2005 Express (http://msdn.microsoft.com/vstudio/express/visualc/) edition, which is free and available for download on microsoft's site.
# 4 Re: [RESOLVED] A few questions before i go too far
Also if you are at the base level of programming in MFC, better try to create a window using console application in VC 6.0 editor.
# 5 Re: [RESOLVED] A few questions before i go too far
Im not too keen on using Visual C++ when I start doing so. The reason being is that I want to do it the hard way to pick up the fundamentals.I've never understood programmers with this attitude. I don't mean that as a criticism - but it seems to be such a common trait among programmers - always wanting to do everything the hardest way possible... :confused:
It won't do you any harm to learn programming from the WinAPI start point but don't spend too much time on it. WinAPI programming isn't object oriented and there's little point in learning C++ if you're not going to take advantage of object oriented development. Borland used to have something similar called ObjectWindows. Don't know if that's still around though... Good luck, reeksy!! :wave:
# 6 Re: [RESOLVED] A few questions before i go too far
Hi.
Using WordPad and Borlands C++ Compiler 5.5
Im a web programmer by trade and Im currently learning C++. I have brought Herbert Schildts book: C++: A Beginner's Guide which is great. Schildt is well-known for his badly edited books, plus the erroneous things he says in his books.
http://www.accu.org/index.php/book_reviews?url=search.xqy%3Fx&term=schildt&field=author
(At the moment) Im learning C++ really quickly and its all making sense!And you're learning some of the most incorrect things about the language.
If you want good books go to www.accu.org and see which books are highly recommended. Sorry to say, but you wasted your money. You bought into (as one reviewer describes it) "marketing over quality".
Regards,
Paul McKenzie
# 7 Re: [RESOLVED] A few questions before i go too far
I have to agree. The book you are using has so many errors, that if an intern came to my company and stated that he had "learned everything he knew" from that book, the interview would almost certainly end very quickly....
# 8 Re: [RESOLVED] A few questions before i go too far
If you are going to practice Win32 APi's first then you can very well use Visual C++ 2005 Express (http://msdn.microsoft.com/vstudio/express/visualc/) edition, which is free and available for download on microsoft's site.
Indeed. That's what I use at home to do Win API programming.
:)
And just to prove that this is not an easy option ... you need to do the following before you can use Visual C++ 2005 Express with the Win API:
http://msdn2.microsoft.com/en-gb/express/aa700755.aspx
;)
# 9 Re: [RESOLVED] A few questions before i go too far
http://www.accu.org/index.php/book_reviews?url=search.xqy%3Fx&term=schildt&field=author
:eek: :cry:
# 10 Re: [RESOLVED] A few questions before i go too far
Wow - OK thanks for the replies!
I had no idea the book i'm using was so bad! I'll have to order another title!
OK so in a nutshell C++ programming using the win32 API is the way to go for C++ windows programming. I'm not too sure what the difference between the win32 API is and the MFC. Can someone clarify this please?
# 11 Re: [RESOLVED] A few questions before i go too far
Win API programming means calling a lot of C functions provided by Windows.
MFC is a wrapper class library which is meant to make it easier to use those functions in C++.
For example:
In Win API, you call CreatePen (http://msdn2.microsoft.com/en-us/library/ms535467.aspx) which returns an HPEN (a handle to a pen for drawing). When you are finished with the HPEN you have to call DeleteObject (http://msdn2.microsoft.com/en-us/library/ms533225.aspx).
In MFC, you create an instance of the CPen (http://msdn2.microsoft.com/en-us/library/czhcb94f(VS.80).aspx) class which looks after the HPEN for you. The CPen class' destructor automatically deletes the HPEN for you.
# 12 Re: [RESOLVED] A few questions before i go too far
So MFC is a better choice than win32 then as it supports OOP?
If this is the case, I assume that the Borland C++ compiler doesnt come with the MFC library? Where would you get the MFC library from?
Jon
# 13 Re: [RESOLVED] A few questions before i go too far
Download and use Microsoft Visual Studio Express 2005. As Krishnaa already mentioned it is free for personal use.
Borland has its own GUI framework called Visual Component Library (VCL). I do not like it, is cumbersome to handle and sometimes non-intuitive. I do not think you can just download and install the MFC library with Borland compilers since Borland uses its own library format (OMF vs COFF). Compiling the library will fail, too, because MFC uses some MS dependent compiler switches (maybe even keywords). You are really better of downloading the MS VS2005 Express package.
# 14 Re: [RESOLVED] A few questions before i go too far
So MFC is a better choice than win32 then as it supports OOP?
In theory, yes.
In practice it can be very annoying. For example, when I create a CRect object I would expect the constructor to initialise top,left,right,bottom to zero, but the default constructor does no such thing, those values are not initialised. So MFC has its good sides and its bad sides.
In the software industry, MFC is used a lot because it comes with Visual Studio Professional and most C++ developers who write Windows applications know how to use it.
There are of course alternatives to MFC, but whichever you choose, you'll want to use some C++ framework (even if you write a simple one yourself) because writing in pure Win API is painful.
If this is the case, I assume that the Borland C++ compiler doesnt come with the MFC library? Where would you get the MFC library from?
As far as I know you have to buy Visual Studio Professional to get MFC.
# 15 Re: [RESOLVED] A few questions before i go too far
OK thanks
The only issue I have with VS is that I feel like a complete novice whilst I aimless click and navigate around the VS GUI. Whereas using a text-editor forces you to learn a language line-by-line.
So to clarify, I can still use the MFC library with VS2005 Express? Im not limited to only the win32 API?
# 16 Re: [RESOLVED] A few questions before i go too far
So to clarify, I can still use the MFC library with VS2005 Express? Im not limited to only the win32 API?
No, like I said, as far as I know you cannot use MFC with the express version, you need to buy the full product.
# 17 Re: [RESOLVED] A few questions before i go too far
...Whereas using a text-editor forces you to learn a language line-by-line.
I don't understand your statement. Whether you are using simple text editor or full IDE, you still have to type line-by-line most of the source code.
# 18 Re: [RESOLVED] A few questions before i go too far
Well creating and styling the windows and window elements is all done via the GUI.
Thanks for all your help this is resolved for now,
Jon.
# 19 Re: [RESOLVED] A few questions before i go too far
Well creating and styling the windows and window elements is all done via the GUI.
Visual C++ is not like Borland Builder. The C++ code is mostly written 'by hand'.
Yes, there's a resources editor which lets you design dialogue boxes and there are various class wizards which do generate common C++ constructs, but I find they hinder more than they help and I usually ignore them.
What you don't want to live without is the automatic building and debugging facilities which an Integrated Development Environment offers.
# 20 Re: [RESOLVED] A few questions before i go too far
Well creating and styling the windows and window elements is all done via the GUI.
In most cases that part yes, but you still have to write the rest of the code. You really don't think that by using drag and drop and nice Form Designer, that is all to witting C++ programs do you?
# 21 Re: [RESOLVED] A few questions before i go too far
Hang on, the form designer only works with .net projects, not with Win API projects.
In fact, you don't even get the native resources editor with the express version of Visual C++.
# 22 Re: [RESOLVED] A few questions before i go too far
Yes, I'm aware that Express does not provide it. I was referring more to use GUI editor to create UI controls for MFC and I used Form designer name liberally.
Either way, my point was that even using any kind of GUI form designer does not alleviate you the Programmer providing most of the code by hand typing.
# 23 Re: [RESOLVED] A few questions before i go too far
Yes, there's a resources editor which lets you design dialogue boxes and there are various class wizards which do generate common C++ constructs, but I find they hinder more than they help and I usually ignore them.
So do you write your windows 'from scratch' then?
# 24 Re: [RESOLVED] A few questions before i go too far
At home I do, partly because I never had access to MFC. It is not very difficult to write you own wrapper classes if you are the only one who is going to use them. See for example this screenshot (http://www.rclsoftware.org.uk/gravel/v2/editor.gif) of an application I wrote using Win API.
At work we use MFC, although Borland's OWL libraries were still used when I started there, but even at work I hardly ever use the resources editor or the code wizards. I find it easier to add a few lines of code by hand.
By the way, there are a few independent libraries as well, for example wxWidgets (http://www.wxwidgets.org/).
# 25 Re: [RESOLVED] A few questions before i go too far
The app (from the screenshot) looks good. The problem ive got now is how i go about establishing a database connection. I have win32 set up and running in VS2005 Express but querying a database looks like a challenging prospect!
Could you point me in the direction of any good resources/tutorials?
Jon
# 26 Re: [RESOLVED] A few questions before i go too far
I don't know a lot about accessing a database,
but you can find most Windows development information here:
http://msdn2.microsoft.com/en-us/library/default.aspx
:)