Experienced VC++ programmers, please assist VB guy lookin to learn C++ 
Author Message
 Experienced VC++ programmers, please assist VB guy lookin to learn C++

Hello,
Let me start off by apologizing if you don't feel this is in the right NG.
I am trying to get as much help as possible.  I am learning VC++, but I have
a big problem:  I don't know how to write the actual program.

For example, I'm used to VB.  In that, all I have to do is draw the
controls, and add the code to have them interact with each other.  I'm not
sure how I can do that with VC.  I know you don't draw controls, but I dont'
know what code is supposed to go into a header file, and what goes into the
actuall .cpp file and what goes elsewhere.  Basically, I'm used to having
everything in one place as opposed to knowing how to tie different
components together.

If somebody could point me to a site that offers help, or better yet, if
someone would be willing to instruct a VC newbie (for free, I haven't much
money) so that I could get one-on-one help, I would be most grateful.

Thank you in advance,
      ~ Chris

------------------------
That which is, is.  That which is not, is not.
What is this? This is.
                                     -Charly



Tue, 30 Oct 2001 03:00:00 GMT  
 Experienced VC++ programmers, please assist VB guy lookin to learn C++
I might be able to help

Aaron Hughes
ICQ 38749113

Quote:

> Hello,
> Let me start off by apologizing if you don't feel this is in the right NG.
> I am trying to get as much help as possible.  I am learning VC++, but I have
> a big problem:  I don't know how to write the actual program.

> For example, I'm used to VB.  In that, all I have to do is draw the
> controls, and add the code to have them interact with each other.  I'm not
> sure how I can do that with VC.  I know you don't draw controls, but I dont'
> know what code is supposed to go into a header file, and what goes into the
> actuall .cpp file and what goes elsewhere.  Basically, I'm used to having
> everything in one place as opposed to knowing how to tie different
> components together.

> If somebody could point me to a site that offers help, or better yet, if
> someone would be willing to instruct a VC newbie (for free, I haven't much
> money) so that I could get one-on-one help, I would be most grateful.

> Thank you in advance,
>       ~ Chris

> ------------------------
> That which is, is.  That which is not, is not.
> What is this? This is.
>                                      -Charly



Tue, 30 Oct 2001 03:00:00 GMT  
 Experienced VC++ programmers, please assist VB guy lookin to learn C++

Quote:

>Hello,
>Let me start off by apologizing if you don't feel this is in the right NG.
>I am trying to get as much help as possible.  I am learning VC++, but I
have
>a big problem:  I don't know how to write the actual program.

>For example, I'm used to VB.  In that, all I have to do is draw the
>controls, and add the code to have them interact with each other.  I'm not
>sure how I can do that with VC.  I know you don't draw controls, but I
dont'
>know what code is supposed to go into a header file, and what goes into the
>actuall .cpp file and what goes elsewhere.  Basically, I'm used to having
>everything in one place as opposed to knowing how to tie different
>components together.

>If somebody could point me to a site that offers help, or better yet, if
>someone would be willing to instruct a VC newbie (for free, I haven't much
>money) so that I could get one-on-one help, I would be most grateful.

    I don't use VC++, but I can at least help you with the correct
    terminology.

    First of all, you'll note that I have removed comp.lang.*
    from the list of newsgroups. Questions about specific
    compilers and/or O/S do NOT belong in the comp.lang
    group which exists solely for the discussion of the language.
    They really don't want to know about MFC, OWL, VC++
    BC++, Windows, Unix or Mac. Just the C/C++ language.

    VB is both a language and a compiler product.  On the
    other hand, you need to make a clear distinction between
    the following:

    (a) C/C++ is a language governed and described by an
    ANSI standard. There is nothing in the standard C/C++
    language that is specific to any operating system,
    compiler, vendor, GUI interface. Standard ANSI C/C++
    code should run on any operating system.

    (b) VC++ is a Microsoft compiler for C and/or C++
    Compare with equivalent compilers sold by Borland (Inprise),
    Watcom,  etc).  Like all good compilers, this one can
    compile and link standard ANSI C/C++ which is completely
    independent of O/S

    (c) MFC is Microsoft Foundation Class - a library of C++
    classes that provides a C++ interface to the Windows API
    and which also provides many other useful functionality
    built on the base Windows functionality.

    You said you were learning VC++.  Not exactly, your
    questions are about basic C/C++ programmign and that
    has nothing to do with VC++, MFC or Windows.
    You might also be attempting to learn MFC, but that is
    Windows-specific and is not related to standard ANSI
    C/C++

    Here's the basic C/C++ methodology.

    In module xxx.cpp, you create a function or class,
    probably called xxx(). You also create an xxx.h
    file that contains the definition of the function or class.

    The xxx.cpp module #includes the xxx.h file. When
    it is compiled, the compiler will make sure the implementation
    (xxx.cpp) of the function or class matches the definition
    of the function or class. The resulting OBJ or LIB is now
    ready to be linked with the rest of the code.

    In another module, perhaps yyy.cpp, you call the xxx()
    function or class.  The yyy.cpp file also #includes the xxx.h
    file. The compiler uses that to ensure that you are calling
    the function/class correctly. It's the *.h file that guarantees
    that the caller and callee match.

    The *.h files can contain millions of lines of code, but they
    do not add a single byte of code to the compiled code
    or EXE, that's because they contain the definitions of the
    data types, function prototypes and classes, but they do
    not contain any variables. The variables are in the .cpp
    file.  Think of the *.h files as dictionaries - they provide
    the definitions of constants, data types, functions etc
    to the .cpp module being compiled, but the compiler
    ignores most of the stuff except for that which it can't
    find in the .cpp file.

    It wouldn't hurt for you to get a good book for learning C
    and get some of the basics under your belt before you
    start learning Windows programming and/or MFC.

--
John A. Grant  * I speak only for myself *  (remove 'z' to reply)
Airborne Geophysics, Geological Survey of Canada, Ottawa
If you followup, please do NOT e-mail me a copy: I will read it here



Tue, 30 Oct 2001 03:00:00 GMT  
 Experienced VC++ programmers, please assist VB guy lookin to learn C++

Quote:

>Hello,
>Let me start off by apologizing if you don't feel this is in the right NG.
>I am trying to get as much help as possible.  I am learning VC++, but I have
>a big problem:  I don't know how to write the actual program.

>For example, I'm used to VB.  In that, all I have to do is draw the
>controls, and add the code to have them interact with each other.  I'm not
>sure how I can do that with VC.  I know you don't draw controls, but I dont'
>know what code is supposed to go into a header file, and what goes into the
>actuall .cpp file and what goes elsewhere.  Basically, I'm used to having
>everything in one place as opposed to knowing how to tie different
>components together.

I would suggest getting a copy of C++Builder. That C++ compiler uses the same
method to created GUIs.

John - N8086N
Big brother is watching. Disable cookies in your web browser.
-------------------------------------------
Wise man says "Never use a bank with the initials F. U."
-------------------------------------------
Are you interested in a professional society or
guild for programmers? Want to fight section 1706?

See www.programmersguild.org
Newsgroup: us.issues.occupations.computer-programmers

EMail Address:



Wed, 31 Oct 2001 03:00:00 GMT  
 Experienced VC++ programmers, please assist VB guy lookin to learn C++

Quote:

>Hello,
>Let me start off by apologizing if you don't feel this is in the right NG.

I think you should be able to distinguish between C/C++ and Microsoft's
class libraries as explained in the previous posts.  This is important.  C
and C++ are powerfully simple languages ( I will probably get hammered on
that statement) and that is their elegance the number of keywords is small
but by using pointers, typecasts ( and yes you will have to use typecasts in
VC++ much to the chagrin (sp) of purists, who ports MFC to anything else
anyway?) arrays, loops, etc .  you will be able to accomplishs many
programming feats simply or quite elegantly.  Heck you could write a VB
compiler.

Anyway what I am trying to say is that you will need an intermediate level
of ANSI C programming. And a beginners understanding of ANSI C++.  Forget
STL for now and if you decide to dissect the Scribble application realize
that this example immediately introduces a Microsoft template class.  They
use it to store CPoint objects.  I think the introduction of this template
class is confusing and if you read the example realize that this animal is
build into the this introductory example, not to mention the multidocument
view architecture(?)

Anyways what I would suggest you do is let the developer studio generate a
Dialog based application for you.  It will be built minimally with three
classes.  The first class will inherit from CWinApp and will be called
something like CMyProgramName.  The second class will CAboutDlg.  it is
derived from CDialog.  And it as it class name alludes is a "About"  box
thing  (Most often things are what they are and nothing else).  The third
will be the application dialog box.  This class will be called something
CMyProgramNameDlg.  All these classes will be generated for you.  If you
compile/run them a blank dialog window will show up on the desktop with two
buttons Ok and Cancel.  This is your starting point.

If you go into the resource editor, the second tab in the workspace window
and find the application dialog and click on it.  Then a window will appear
that looks just like the blank window you saw moments ago when you ran the
application.  However this window is in design mode and you may add controls
to it.  Look for the controls toolbar. Notice that the controls list does
not look as impressive as VB.  But that will not be a problem later on, just
now.  You will probably have to confine yourself to those controls for now.
Add the controls to your dialog and compile/run  the application.  Looks
better now but still does not do anything.

The next step will be to add actions to your application dialog class.  This
can be accomplished VBish by double clicking on the control and selecting
the type of handler you wish to implement (OnEditChange, OnKeyDown, OnKeyUp,
OnLeftMouse etc.).  Once selected you can add code to the the function much
like VB, only this time it is C/C++.

One other way is to use the class wizard. This lets you see all the
controls, menus, resource IDs and classes on one dialog.  Select a class and
add handlers for menu items, controls, command messages, user messages and a
whole lot of other things.

Controls
If you put a static on the dialog read up on the class CStatic and/or at
least understand how to use the following code snippet
                                            CString str = "Some string"

GetDlgItem(IDR_RESOURCEID)->SetWindowText(str);
If you use and edit box read up on CEdit, a combo box CCombo box etc.  Or
better yet print them out and hang on them because you will be using them
from here out.

Also find someone who has been through the beginning stages to look at your
code when you have a problem.  This will move you a lot further along than
having to step through the underlying code.  You will however at some point
step through a lot of code that is provided in the form of an application
framework.

This is all I can write now.

Now to improve on the controls and classes visit a site like
www.codeguru.com.  There you will find a lot code, ideas and tricks to write
killer applications.  The folks there are doing a great job.
You can also buy code from some really good companies.

Later
Joe Frisco PE



Wed, 31 Oct 2001 03:00:00 GMT  
 Experienced VC++ programmers, please assist VB guy lookin to learn C++

says...

[ ... ]

Quote:
> For example, I'm used to VB.  In that, all I have to do is draw the
> controls, and add the code to have them interact with each other.  I'm not
> sure how I can do that with VC.  I know you don't draw controls, but I dont'
> know what code is supposed to go into a header file, and what goes into the
> actuall .cpp file and what goes elsewhere.  

I'd start off with something similar to what you're accustomed to:
start an MFC AppWizard dialog-based application.  If you open the main
dialog, you can work almost like you're accustomed to in VB: you draw
controls on the dialog, do a ctrl-double-click on the control, and add
a bit of code (in C++ instead of VB, of course) to deal with the
default action of that control (e.g. click on a button).

After you're accustomed to this, you can branch out toward other
things to which you're less accustomed...



Wed, 31 Oct 2001 03:00:00 GMT  
 Experienced VC++ programmers, please assist VB guy lookin to learn C++

Quote:

>Hello,
>Let me start off by apologizing if you don't feel this is in the right NG.
>I am trying to get as much help as possible.  I am learning VC++, but I
have
>a big problem:  I don't know how to write the actual program.

>For example, I'm used to VB.  In that, all I have to do is draw the
>controls, and add the code to have them interact with each other.  I'm not
>sure how I can do that with VC.  I know you don't draw controls, but I
dont'
>know what code is supposed to go into a header file, and what goes into the
>actuall .cpp file and what goes elsewhere.  Basically, I'm used to having
>everything in one place as opposed to knowing how to tie different
>components together.

I would strongly suggest that you go out and buy a good book. Charles
Petzold's "Programming Windows, 5th Edition" is the classic (Microsoft
Press).

Chris
-----------------------------------------------------------------------

Visit our web site at http://www.skymap.com
Astronomy software written by astronomers, for astronomers



Wed, 31 Oct 2001 03:00:00 GMT  
 Experienced VC++ programmers, please assist VB guy lookin to learn C++



Quote:


> >Hello,
> >Let me start off by apologizing if you don't feel this is in the right
NG.
> >I am trying to get as much help as possible.  I am learning VC++, but I
> have
> >a big problem:  I don't know how to write the actual program.

> >For example, I'm used to VB.  In that, all I have to do is draw the
> >controls, and add the code to have them interact with each other.  I'm
not
> >sure how I can do that with VC.  I know you don't draw controls, but I
> dont'
> >know what code is supposed to go into a header file, and what goes into
the
> >actuall .cpp file and what goes elsewhere.  Basically, I'm used to
having
> >everything in one place as opposed to knowing how to tie different
> >components together.

> I would strongly suggest that you go out and buy a good book. Charles
> Petzold's "Programming Windows, 5th Edition" is the classic (Microsoft
> Press).

Petzold's book is good for understanding how the Windows API works
from the ground up but I would also recommend reading Jeff Prosise's
"Programming Windows with MFC" (Microsoft Press).  Prosise's book
explains how MFC (Microsoft Foundation Classes) can be used
for developing Windows applications.  It is a class library that
comes with your VC++ compiler and which encapsulates the
API into a set of base classes.  In contrast with the SDK approach
of Petzold's book which is C oriented, MFC is C++ oriented. For
most routine Windows programming MFC is easier and quicker
to use.  On the other hand a study of Petzold's book will give
you a much firmer grasp of how Windows works.

                        Jim F.

- Show quoted text -

Quote:

> Chris
> -----------------------------------------------------------------------

> Visit our web site at http://www.skymap.com
> Astronomy software written by astronomers, for astronomers



Wed, 31 Oct 2001 03:00:00 GMT  
 Experienced VC++ programmers, please assist VB guy lookin to learn C++

Quote:

>Hello,
>Let me start off by apologizing if you don't feel this is in the right NG.
>I am trying to get as much help as possible.  I am learning VC++, but I have
>a big problem:  I don't know how to write the actual program.

>For example, I'm used to VB.  In that, all I have to do is draw the
>controls, and add the code to have them interact with each other.  I'm not
>sure how I can do that with VC.  I know you don't draw controls, but I dont'
>know what code is supposed to go into a header file, and what goes into the
>actuall .cpp file and what goes elsewhere.  Basically, I'm used to having
>everything in one place as opposed to knowing how to tie different
>components together.

>If somebody could point me to a site that offers help, or better yet, if
>someone would be willing to instruct a VC newbie (for free, I haven't much
>money) so that I could get one-on-one help, I would be most grateful.

Use App Wizard to create a dialog-based app.  Now go to the Resource Editor
and add a button called 'Test' to your main dialog.  Give it the identifier
IDC_TEST.

Go to Class Wizard and add a message handler for IDC_TEST to your dialog
class.  It will be called something like OnTest().  Find the OnTest() function
in Class View, go to it and add the line:
SetWindowText( "Hello MFC World" );

Compile and run your program.  When you press the 'Test' button, the dialog
title will change.  Now that you have a working program with input and output,
you can start learning the basics of C++.  

Add a member function to your dialog class with type void and declaration
Foo().  Add a member variable as well.  Look in File View for the source and
header of this class and examine them.  (The OnTest() function is special,
don't worry about that for now.)

Set your member variable to zero in the class constructor, then modify your
test function so it adds one to the variable and prints a different string
depending whether it is odd or even.

You will do well to learn a few more MFC basics like creating and painting a
child window in the dialog, and responding to mouse clicks.  (Or you can
just carry on with button input and string output if you like.)  Once you have
learned these, forget about MFC for a while, and make some classes of your
own, with functions that the main dialog can call to do interesting things.  
I.e. use MFC as a shell while you learn C++.

This is just a quick guide to get you up and running so you can learn by
doing.  It's how I started, anyway!  Of course you should get some books too.

- Gerry Quinn
http://bindweed.com



Wed, 31 Oct 2001 03:00:00 GMT  
 Experienced VC++ programmers, please assist VB guy lookin to learn C++
 I think that starting with the MFC application though being very VBlike
in design, is going to be confusing if the person does not know C or C++.
There are plenty of good books out there that will teach C and C++. Most
of the sample programs in those books will compile and run in Visual C++.

Just open a blank document. Type in the sample code. Click on the run
button and it will ask if you want to create a project for this. Click
Yes.  After the comnpile is done, your code can be run and debugged.

I think that if you were to jump straight into the MFC, you will easily
be able to add handlers, but then what do you do? Learning the basics
will then lead you to being able to program effectively in VC++.



Sat, 03 Nov 2001 03:00:00 GMT  
 Experienced VC++ programmers, please assist VB guy lookin to learn C++

Quote:

>Hello,
>Let me start off by apologizing if you don't feel this is in the right NG.

Don't let these ninnies bother you with off-topic stuff...

Actually, knowing VB is a very good introduction to VC++.  The only real
difference (besides the underlying language, of course) is that the system "glue"
that makes a mouse click call your VB function, for example, must now be carefully
coded in a message map (or at least carefully added via the Class Wizard).  
Another difference is that you must use an App Wizard to get the whole ball
rolling, as opposed to just having it there automatically.  Another difference is
that VC++ enforces a document-view style (unless you choose a dialog based app)
whereas VB is strictly dialog style.  In general, you must do more to get VC++ to
do what you want, but it gives you more options.

As for the C++ stuff, yes, you should really feel comfortable in C++ before
attempting VC++.  You will need to be able to use and understand classes derived
from MFC to have any hope of knowing what you're doing.

Quote:
>Thank you in advance,
>      ~ Chris

>------------------------
>That which is, is.  That which is not, is not.
>What is this? This is.
>                                     -Charly



Mon, 12 Nov 2001 03:00:00 GMT  
 Experienced VC++ programmers, please assist VB guy lookin to learn C++
Quote:


> Actually, knowing VB is a very good introduction to VC++.

That's debatable <g>.

Quote:
> Another difference is that you must use an App Wizard to get the whole ball
> rolling

Must? You can get the ball rolling w/o any wizardry at all.

Quote:
> Another difference is that VC++ enforces a document-view style
> (unless you choose a dialog based app)

Wrong again. VC doesn't give a hoot about doc/view. MFC does, that's
true.

Quote:
> As for the C++ stuff, yes, you should really feel comfortable in C++ before
> attempting VC++.

Why? You can write straight C++ with VC w/o wizards, MFC, and so on.
It's just a compiler.

Quote:
> You will need to be able to use and understand classes derived
> from MFC to have any hope of knowing what you're doing.

Only if you use MFC.


Mon, 12 Nov 2001 03:00:00 GMT  
 Experienced VC++ programmers, please assist VB guy lookin to learn C++

Quote:



> > Actually, knowing VB is a very good introduction to VC++.
> That's debatable <g>.

> > Another difference is that you must use an App Wizard to get the whole ball
> > rolling
> Must? You can get the ball rolling w/o any wizardry at all.

> > Another difference is that VC++ enforces a document-view style
> > (unless you choose a dialog based app)
> Wrong again. VC doesn't give a hoot about doc/view. MFC does, that's
> true.

> > As for the C++ stuff, yes, you should really feel comfortable in C++ before
> > attempting VC++.
> Why? You can write straight C++ with VC w/o wizards, MFC, and so on.
> It's just a compiler.

> > You will need to be able to use and understand classes derived
> > from MFC to have any hope of knowing what you're doing.
> Only if you use MFC.

What are the major differances and reasons why someone would use C++ rather
than Cobol in the same industry, using the same backend?


Sent via Deja.com http://www.deja.com/
Share what you know. Learn what you don't.



Mon, 12 Nov 2001 03:00:00 GMT  
 
 [ 13 post ] 

 Relevant Pages 

1. Experienced VC++ programmers, please assist VB guy lookin to learn C++

2. vb programmer learning vc

3. VB Programmer learning C++

4. VB Guy wants to learn C#

5. Positions available for experienced c/c++ programmers

6. seeking C++ programmer with directx experience

7. Tell me you experience in convert code from VB 6 to VB.NET or C#

8. book to learn C++ for C programmers

9. FREE TRAINING (C++ for C programmers, also learn C)

10. How does a VB person Learn C++

11. best book to learn vc from vb

12. VB programer needing help learning how to add custome control to VC++ application

 

 
Powered by phpBB® Forum Software