#16
  1. No Profile Picture
    Contributing User
    Devshed Beginner (1000 - 1499 posts)

    Join Date
    Feb 2001
    Posts
    1,472
    Rep Power
    15
    So they don't explain what the code means that you're inserting or generating using a wizard?

    I recently finished programming a simple window with one line of text in it without the assistance of the AppWizard or MFC , and there is a good deal of code you have to write just for that. They call that learning the "Windows API". With the AppWizard, you just have to say what kind of program you're writing, and presto the wizard produces all the code for the basic framework of your program for free. Then you have to tailor that framework for your application. I don't know much about MFC, but I think you derive classes from a standard library of super classes to use in your program that have the built in functionality you require. That keeps programmers from having to reinvent ways of doing things. Anyway, if you don't know what's going on in the code the AppWizard generated, it seems like an impossible task to do much customizing.

    Before I became comfortable enough with PHP, I had to learn all the ins and outs of what I was going to use. Even after I started building scripts, I always had to refer back to one of my books to see how to do something.

    That's the way I learned php too. Once you get some basic syntax down, you can jump right in and look up stuff you need and figure out how to do things. I don't think C++ is conducive to that way of learning things because it's so technical. Sure, you can learn the basic features of the language and write programs using loops, arrays, etc., but the heart of C++ is really using pointers and references with classes and taking advantage of OOP and the benefits of polymorphism and inheritance, so C++ texts get very complex very fast.

    I worked my way through Ivor Horton's Beginning C++ 6.0, which I found very challenging. Now, I'm doing the same with Ivor Horton's Visual C++ 6.0 where the first 12 chapters are C++(I'm reviewing pointers, classes, polymorphism, etc. right now) and then it gets into Windows programming and MFC, and I've looked ahead into the Windows/MFC chapters and it doesn't look easy. I would recommend Ivor Horton's books wholeheartedly. I'm not sure why anybody would learn C instead of C++(maybe it's easier?).

    Sorry, I have no experience integrating C++ with PHP, if that's what you were asking.

    In the description of the program you posted, it sounded like that's what you wanted to do.
    Last edited by 7stud; February 21st, 2003 at 02:55 AM.
  2. #17
  3. Rut row Raggy!
    Devshed Novice (500 - 999 posts)

    Join Date
    Jul 2001
    Location
    Tornado Alley
    Posts
    560
    Rep Power
    30
    I recently finished programming a simple window with one line of text in it without the assistance of the AppWizard or MFC , and there is a good deal of code you have to write just for that. They call that learning the "Windows API".

    I started a few weeks ago with a book on game programming. It explained in fair detail what each line ment, but also said "you don't really need to understand how it works" when explaining a lot of the functions.

    I worked my way through Ivor Horton's Beginning C++ 6.0, which I found very challenging. Now, I'm doing the same with Ivor Horton's Visual C++ 6.0 where the first 12 chapters are C++(I'm reviewing pointers, classes, polymorphism, etc. right now) and then it gets into Windows programming and MFC, and I've looked ahead into the Windows/MFC chapters and it doesn't look easy. I would recommend Ivor Horton's books wholeheartedly. I'm not sure why anybody would learn C instead of C++(maybe it's easier?).

    I saw his book at Borders, but I'm not a fan of those big technical picture and example-less books with the red covers...so I tend to avoid them. :) As far as learning C first, well, in the first chapter of Petzold's book, it says you must be familar with C first.

    In the description of the program you posted, it sounded like that's what you wanted to do (integrate C++ w/PHP).

    No, I want to make a weather forecasting desktop program. I mentioned PHP because the syntax and concepts are simliar in C and C++ (since it's based on them). Sorry for not making that clear.
    Matt
  4. #18
  5. Contributing User
    Devshed Supreme Being (6500+ posts)

    Join Date
    Jan 2003
    Location
    USA
    Posts
    7,087
    Rep Power
    2222
    Regarding programming with MFC, you do get a collection of base classes that your classes inherit from.

    For example, CDialog handles the opening and closing of a dialog box as well as passing data to and from it, etc. But it does not any controls except for two buttons: OK and Cancel. Then you create a class that inherits from CDialog, populate it with controls, and add code that defines the dialog's behavior. Finally, you write a function within the calling module that sends initialization data, opens the dialog, and retrieves the dialog data if OK was clicked. Pretty much the same thing happens as you derive your own view, document, and control classes from the MFC base classes.

    But the major thing MFC does is that it encapsulates the Windows messaging system. A standard C Win32 application looks like a giant switch statement in which you handle every message that you are interested in, plus you have to keep the switch statements for the different windows straight (something I had a problem with).

    In an MFC app, when you design a dialog or a view or any other window object (since those are the ones that process messages), you use the Class Wizard to choose which events you are interested in. VC++ will then create a method in your class to handle that event; eg, OnInitDialog() will handle the WM_INITDIALOG event, OnMouseMove() will handle WM_MOUSEMOVE with the mouse parameters passed to it.

    So, learning Win32 before MFC would teach you what those Windows messages are, which you still need to know in MFC. Plus how to work with the controls, some of which is rather thinly encapsulated.

    My first big plunge into MFC was led by Ivor Horton's "Beginning Visual C++ 4". I found his CScrollView examples to be very helpful, but since I already knew C++ I didn't read that part of the book.

    And I still keep my Petzold book handy for some of the detailed stuff that I can't find in the help files.
  6. #19
  7. No Profile Picture
    Contributing User
    Devshed Beginner (1000 - 1499 posts)

    Join Date
    Feb 2001
    Posts
    1,472
    Rep Power
    15
    dwise1_aol,

    Thanks for the informative post. I'm still a little confused about what Widows programming and MFC are all about, and I enjoyed reading your explanation.

    marron79,

    I saw his book at Borders, but I'm not a fan of those big technical picture and example-less books with the red covers...so I tend to avoid them.

    I have several Wrox books(including Beginning PHP and Beginning Javascript) and they are all packed with code snippets explaining the concepts as well as full fledged examples with the output, and the thing I like best about them are the four or five practice problems at the end of each chapter with solutions(online or in an appendix). I have never found any other texts with practice problems w/ solutions or as logically written, so I stuck with Wrox, although I always check the reviews, and the one's I've purchased were always considered one of the best books on the subjects.

    Anyway good luck to you. If you find a good book let me know.
    Last edited by 7stud; February 21st, 2003 at 08:41 PM.
  8. #20
  9. Contributing User
    Devshed Supreme Being (6500+ posts)

    Join Date
    Jan 2003
    Location
    USA
    Posts
    7,087
    Rep Power
    2222
    Originally posted by 7stud
    dwise1_aol,

    Thanks for the informative post. I'm still a little confused about what Widows programming and MFC are all about, and I enjoyed reading your explanation.

    Just as the skinniest of skinnies, Windows controls all the resources and when something happens (AKA "an event"), it sends the appropriate messages to the current window which either handles the event or passes it back to Windows. These events include mouse events (left/right button down/up, mouse moved), keyboard events (key pressed), timer events, notifications from window controls (eg, a particular control in the window was clicked on), the window has been created or closed or resized, etc.

    Your application is basically a loop that reads each message and decides whether to handle it or not -- actually, you decided whether to handle it or not when you wrote the program and either included that event handler or not. Your program starts by creating a main window for which you define a WinProc callback function. Then you settle into a loop which reads the message queue for messages. When a message arrives for your app, the WinProc runs, in which a really long switch statement has a case for that message and handles that event, sometimes with API function calls to Windows. If you did not include a case for that event, then the message is passed back to Windows for default processing. Read the first chapter of Petzold for his "Hello, world!" program that's a hundred lines long.

    Again, the really nice thing that MFC does for you is that it handles that whole business of reading and processing messages and lets you concentrate on your event handlers.
  10. #21
  11. Rut row Raggy!
    Devshed Novice (500 - 999 posts)

    Join Date
    Jul 2001
    Location
    Tornado Alley
    Posts
    560
    Rep Power
    30
    Originally posted by dwise1_aol
    So, learning Win32 before MFC would teach you what those Windows messages are, which you still need to know in MFC. Plus how to work with the controls, some of which is rather thinly encapsulated.

    My first big plunge into MFC was led by Ivor Horton's "Beginning Visual C++ 4". I found his CScrollView examples to be very helpful, but since I already knew C++ I didn't read that part of the book.

    And I still keep my Petzold book handy for some of the detailed stuff that I can't find in the help files.
    So you recommend learing Win32 first too? I also got "C: A Reference Manual" by Harbison & Steele, which looks to be a great reference for reading Petzold's book (since the examples are written in C).

    While looking for the C book, I thumbed through Ivan's Visual C++ book, and I liked what I saw. Not only did the book appear to explain how to use Visual C++, but also talked about MFC, Win32, and C++, in detail w/examples. I thought all those Wrox books were just full of endless text and no examples. Looks like quite a nice all-in-one reference for using Visual C++ to make Windows programs, I must say. So after I takle C and Win32, I'll be picking up that and Jeff's MFC book. One question, though, I've seen a few books on Visual C++ that come with a "introductory" version of Visual C++. What do they mean by "introductory?"

    Thanks again for your insight and recommendations. They were a big help. :)
    Matt
  12. #22
  13. No Profile Picture
    Contributing User
    Devshed Beginner (1000 - 1499 posts)

    Join Date
    Feb 2001
    Posts
    1,472
    Rep Power
    15
    dwise1_aol,

    Read the first chapter of Petzold for his "Hello, world!" program that's a hundred lines long.

    Yep, I've got Ivor's book, and I mentioned above somewhere that I just got done writing a hello world program using only the Windows API.

    marron79,

    Sheesh! You plan on reading a lot of books. My advice: skip C and get Visual C++ 6, which teaches you C++ in the first 12 chapters from scratch, then devotes a chapter to the Windows API so you understand what's going on behind the scenes, and then moves into MFC. You certainly don't need to know C to learn C++, which is just a superset of C. Read "Who is this book for?" here:

    http://www.wrox.com/books/1861001967.htm

    One question, though, I've seen a few books on Visual C++ that come with a "introductory" version of Visual C++. What do they mean by "introductory?"

    I know when I bought the Visual C++ 6.0 compiler, I think it was called a student or standard edition. It was $50, but later I found out I couldn't email one of my apps to a friend, and I had to upgrade to the professional edition to do that. I don't remember any changes when I upgraded. Maybe I got the MSDN library with the upgrade which is a huge help system/library on disc. That book bundled with the compiler seems like a good deal to me. You can click on "Contact Support" if you follow the link above and ask Wrox about that Introductory Visual C++ compiler.
    Last edited by 7stud; February 22nd, 2003 at 01:12 AM.
  14. #23
  15. Rut row Raggy!
    Devshed Novice (500 - 999 posts)

    Join Date
    Jul 2001
    Location
    Tornado Alley
    Posts
    560
    Rep Power
    30
    Sheesh! You plan on reading a lot of books. My advice: skip C and get Visual C++ 6, which teaches you C++ in the first 12 chapters from scratch, then devotes a chapter to the Windows API so you understand what's going on behind the scenes, and then moves into MFC. You certainly don't need to know C to learn C++, which is just a superset of C.

    One question, though, I've seen a few books on Visual C++ that come with a "introductory" version of Visual C++. What do they mean by "introductory?"
    Okay, now I'm confused. I thought you told me to learn Win32 first, then MFC. Are you saying that Ivan's book is all I need to start programming for Windows from scratch? I already bought Petzold's book from Amazon and that C book from Borders. Are you saying I should return those books and get Ivan's book? If so, I'm all for that!
    Matt
  16. #24
  17. No Profile Picture
    Contributing User
    Devshed Beginner (1000 - 1499 posts)

    Join Date
    Feb 2001
    Posts
    1,472
    Rep Power
    15
    Okay, now I'm confused. I thought you told me to learn Win32 first, then MFC. Are you saying that Ivan's book is all I need to start programming for Windows from scratch?

    Well, I personally think it's important to delve into Win32 at least a little bit. How much? I don't really know. Beginning Visual C++6 devotes one chapter to the Windows API. Is that enough? I won't know until I work my way through MFC.

    Yes, Ivor's book will teach you to program Windows from scratch. I would think it would be quicker to work through that book, and then go back and study Win32 if you think you need more understanding.

    I mentioned that I wrote a Hello World app with just the Windows API, and that it was a lot of code, but it was much like filling out a form. I skipped ahead to the first MFC chapter yesterday to see if I could understand what was going on, and I built a text editor app with the AppWizard and MFC, and I didn't have to type in a single line of code. Ivor uses the chapter to explain how an MFC program is set up, and to show the reader what the AppWizard generates and how it derives objects from the MFC.

    After reading that chapter, I had a general understanding of the code based on Ivor's explanation of what it did, and Ivor pointed out what the major functions were for, but there was a lot of other code and most of it seemed Greek to me. However, at the end of the chapter Ivor says this:

    "You probaly won't feel too comfortable with the detail at this point, but don't worry about that now. You'll find that it becomes much clearer once we have applied the ClassWizard and other Visual C++ tools a few times in the succeeding chapters. They'll take care of most of the detail automatically, and an appreciation of what fits where will become quite obvious after a bit of practice."

    So, I remain hopeful.
    Last edited by 7stud; February 22nd, 2003 at 03:18 PM.
  18. #25
  19. Contributing User
    Devshed Supreme Being (6500+ posts)

    Join Date
    Jan 2003
    Location
    USA
    Posts
    7,087
    Rep Power
    2222
    Originally posted by marron79
    Okay, now I'm confused. I thought you told me to learn Win32 first, then MFC. Are you saying that Ivan's book is all I need to start programming for Windows from scratch? I already bought Petzold's book from Amazon and that C book from Borders. Are you saying I should return those books and get Ivan's book? If so, I'm all for that!

    OK, Matt, time for a priority check! What is your goal here? To learn how to do Windows programming or to understand how and why Windows programming works? Hopefully the answer is "both", but which do you feel is more important and more immediate?

    My own philosophy is to learn the harder way first because I learn more that way. For instance, I have always written my web pages by hand instead of with an HTML editor. It takes me a bit longer, but now I understand HTML and can go in and tweak the code when I need to. I prefer the way that will teach me more and that does not hide information from me -- one reason why I still shy away from Visual BASIC.

    But that philosophy has its disadvantages. For one thing, it takes longer before I can produce something useful -- many times I run out of time and never get to that point. A case in point is sockets programming. It took me well over a year of studying TCP/IP and reading through every web site on sockets programming that I could find, before I finally started writing some sockets programs. The more I studied, the more I went into "analysis paralysis", getting my mind so wrapped up worrying about problems and potential problems that I was almost literally afraid to start coding. I finally snapped out of it with a short book that offered some working examples and started writing applications.

    By taking the Win32/C approach, you will learn more about the lower level of Windows programming. But since you are also learning C, you will probably encounter a lot of frustrating C-related problems that will prevent your program from running at all -- and that fatal error could be anywhere in those 100++ lines of code. Yes, you will learn more, but it will be much harder and it will take much longer and you might end up bald (from tearing your hair out).

    MFC will get you writing working Windows programs in a very short time. Just by creating a project and without writing a single extra line of code, the program will compile, link, and execute. Then if you introduce a fatal error with your code, you know that it is in the few lines of code you just added and not in the 100+ lines handling the basic Windows stuff. Then your main source of frustration will be "how do I get MFC to do this minor thing?" instead of "How do I get this program to run?".

    My basic philosophy with computer books is that I look for clear explanations and understandable examples. I use most of my books as references in which I look up explanations on specific questions or examples of code that does about what I'm wanting to do. I'll get some tutorials on new subjects, but I also want to be able to look up specific topics.

    Assuming you take the MFC/C++ approach, you can still use your C reference book for much of the C++ language -- excluding classes, references, function overloading, and streams, of course. And when you learn how to use a control in MFC, you can read Petzold to learn more about it and gain a little extra insight into the inner workings. So your investments to date need not go to waste.

    I forget whether you already have VC++6. One thing I notice when I create a new project is that you also have the option to create a Win32 application. If you choose "typical Hello World" on the next page, then it will create the basic structure for you. So VC++6 does offer you a less-painful way to experiment with Win32 apps if that is your choice.
  20. #26
  21. No Profile Picture
    Junior Member
    Devshed Newbie (0 - 499 posts)

    Join Date
    Feb 2003
    Location
    Hell - Also known as ND
    Posts
    25
    Rep Power
    0
    I'm currently using Borland Builder 6 Pro and Kylix 3 Pro to develop all my applications. Writing the code once and having it run under win32 and Linux is certainly a very big bonus IMHO.

    You can download a 60-day "demo" of the Enterprise Ed of Borland Builder 6 from Borland's site.

    Try it........you might really like it. Or you might hate it. :)
  22. #27
  23. Rut row Raggy!
    Devshed Novice (500 - 999 posts)

    Join Date
    Jul 2001
    Location
    Tornado Alley
    Posts
    560
    Rep Power
    30
    My own philosophy is to learn the harder way first because I learn more that way. For instance, I have always written my web pages by hand instead of with an HTML editor. It takes me a bit longer, but now I understand HTML and can go in and tweak the code when I need to. I prefer the way that will teach me more and that does not hide information from me -- one reason why I still shy away from Visual BASIC.

    Well, in programming you don't have much of a choice if you want to develop something complex. If you're happy with whatever FrontPage can dish out for you with their endless wizards and templates, then you can take the easy way out. I started out learning HTML by making pages with Claris HomePage and editing the HTML myself. Gradually, I became familar enough with HTML that now I think that editors like FrontPage just get in the way....so I use Wordpad instead.

    I shy away from VB too because it's too much like English, so the syntax looks ugly (IMO). But then again, I'm kind of biased against any language that doesn't look like C/C++. :)

    But that philosophy has its disadvantages. For one thing, it takes longer before I can produce something useful -- many times I run out of time and never get to that point.

    That was true with my website. The only difference was that I knew no one else was going to take my idea, so I didn't worry about time. Although, of course, I wanted to get it done as soon as possible.

    The program I want to make is a little different. For one, since Windows programming is a lot more involved than PHP and HTML, it will take make a lot longer to produce a working program. Second, someone I know is already working on a similar project, and he has an advantage in that he's already make a crude (but working) program using mIRC.

    MFC will get you writing working Windows programs in a very short time. Just by creating a project and without writing a single extra line of code, the program will compile, link, and execute. Then if you introduce a fatal error with your code, you know that it is in the few lines of code you just added and not in the 100+ lines handling the basic Windows stuff.

    That is why I now prefer OOP over structed programming. It's so much easier to find errors in my PHP scripts using OOP than it was when they were just a messy collection of commands and functions.

    Assuming you take the MFC/C++ approach, you can still use your C reference book for much of the C++ language -- excluding classes, references, function overloading, and streams, of course. And when you learn how to use a control in MFC, you can read Petzold to learn more about it and gain a little extra insight into the inner workings. So your investments to date need not go to waste.

    That's good to know. :D

    So VC++6 does offer you a less-painful way to experiment with Win32 apps if that is your choice.

    Yes, that is why I plan to get VC++ when I've learned enough to make a program.

    I'm currently using Borland Builder 6 Pro and Kylix 3 Pro to develop all my applications. Writing the code once and having it run under win32 and Linux is certainly a very big bonus IMHO.

    Personally, I don't see any reason why a person should have to spend > $100 on two programs to make a program that works on two platforms. There should be a program that allows you to make programs for Windows, Mac, and Linux!
    Matt
  24. #28
  25. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Feb 2003
    Location
    Right Coast
    Posts
    25
    Rep Power
    0
    Personally, I don't see any reason why a person should have to spend > $100 on two programs to make a program that works on two platforms. There should be a program that allows you to make programs for Windows, Mac, and Linux!

    Matt,

    What you want is Java and perhaps one of the Free IDE/Dev platforms like NetBeans or Eclipse.

    Now, this won't make any snappy games or other such software really suited to C/C++, but you can get very functional programs which tap into a vast and powerful API and have your stated wish above.

    Total cost = $0.00

    J :)
  26. #29
  27. Banned ;)
    Devshed Supreme Being (6500+ posts)

    Join Date
    Nov 2001
    Location
    Woodland Hills, Los Angeles County, California, USA
    Posts
    9,592
    Rep Power
    4207
    >> Personally, I don't see any reason why a person should have to spend > $100 on two programs to make a program that works on two platforms. There should be a program that allows you to make programs for Windows, Mac, and Linux!

    Python and perl (maybe ruby) too, but you probably already knew that :)
  28. #30
  29. No Profile Picture
    Junior Member
    Devshed Newbie (0 - 499 posts)

    Join Date
    Feb 2003
    Location
    Hell - Also known as ND
    Posts
    25
    Rep Power
    0
    >>Personally, I don't see any reason why a person should have >>to spend > $100 on two programs to make a program that >>works on two platforms. There should be a program that >>allows you to make programs for Windows, Mac, and Linux!

    When said tools take of hour(s), week(s), month(s) off your development time for projects. I find it to be quite worth the costs of the tools.

IMN logo majestic logo threadwatch logo seochat tools logo