Visual C++

Fundamentals of C++ VS Mag Visual Studio my c links Visual Basic debugger Books using C++

Using Visual Studio 6 per Ivor Horton's Beginning Visual C++ 6

File | New
if no project openned already, shows project tab choices - what kind of project to create?, initial exercise uses "Win32 Console Application" from 16 options
if project is open, shows file tab choices, e.g. C++ Source File
In C++, instead of #include <stdio.h>
use #include <iostream>
Set Visual C++ Options
Tools -> Options
(more tabs visible by clicking on upper right hand side arrow button)
Set a project's Options
Project -> Settings
especially, to browse information:
on C/C++ tab, check Generate browse info
on Browse tab, check Build browse info file
With these settings, you can find out where in your source code any item is used, where it is defined, just by right clicking on it...
Second project
MFC appwizard (exe)
default options cause appwizard to generate 23 files!
Third project
Win 32 Console Application (again...) Ex2_01
run compiled prgms by Ctrl-F5, or the red ! button, or from Build menu
and Visual Studio adds "Press any key to continue" so you can gaze at output...
Integers
int variables have values -(231) to 231 - 1
integer variables declared long occupy 4 bytes and can have values from -2,147,483,648 to 2,147,483,647 but this is the same as variables declared as int in Visual C++ 6.0 (under 16-bit versions of Visual C++, an int was 2 bytes...
unsigned long mileage = 0UL;    // suffix U and L indicate value is unsigned, long; unsigned long integers have values 0 to 4,294,967,295 or 232 - 1
Characters
char letter = 'A';
char letter = 65;    // is the same thing!!
char letter = 0x41;    // is the same thing!!
Floating Point Variables
float pi = 3.14159f;    // occupies 4 byts, 7 decimal digits precision, have values 3.4x10-38 to 3.4x1038
without the final f, the constant pi would have been of type double, occupying 8 bytes, 15 decimal digits precision with a range of values from 1.7x10-308 to 1.7x10308, positive and negative.
double pi = 3.14159265358979;
Boolean Variables
bool testResult;
testResult = true;     // or false;
Enumeration Variables
enum Week {Mon, Tues, Wed, Thurs, Fri, Sat, Sun} this_week;
defines type Week and variable this_week which takes integer values corresponding to zero-index of item in list, in this case 0 - 6

Read Ivor Horton's Beginning Visual C++ 6 up to page 71; also dove into chptr 7, A taste of Old-Fashioned Windows, p 243; read up to p 252...

struct
struct BOOK
{
   char Title[80];
   char Author[80];
   char Publisher[80];
   int Year;
};
defines a new type in a manner used before C++ (now we use classes...) but lots of windows uses struct since it was written pre-C++
variable name prefix conventions
Notation in Windows Programs (p. 256)
PrefixMeaning
blogical variable of type bool, equiv to int
bytype unsigned char, a byte
ctype char
dwtype dword, which is unsigned long (int)
fna function
ha handle, used to identify something (usually an int value)
itype int
ltype long
lplong pointer
ntype int
pa pointer
sa string
sza zero terminated string
wtype word, which is an unsigned short
lpfnlong pointer to a function

11-21-2004 Using the Debugger

to add a breakpoint, F9. to remove the breakpoint, with cursor at the breakpoint, press F9 again.

with a breakpoint added, F5 executes the code in the debugger.

see the variables window below and left, also the watch windows below and right - if they're aren't there, see icons on debug menu to activate them

to continue execution after breakpoint, just press F5 again!

still a mystery: can you look at all array values somehow??

when you see an array name in Variables window, it looks like an address pointer number...

F1 brings up help in the pertinent debugger window!

6-24-2005: When debugging (press F5, stop at breakpoint set with F9) F10 steps forward one statement at a time. If the statement is a function call, the whole function is called and the focus moves to next line. If you want to instead step through that function, press F11. Shift-F5 stops debugging.

Books on W32 Pgmg, MFC

from codeguru.com forum (found by googling <Visual Studio 6.0 Createwindow "no title bar">


01-02-2003, 10:00 AM, mdmd's Avatar: My choice for WIN32 programming book is "Win32 programming" by Grent Rector and Joseph Newcomer My choice for MFC would be "Programming MFC" by Jeff Prosise although I heard the Professional VC++ book from Wrox press is the best. 01-02-2003, 01:16 PM, tobeyu don't forget the "Bible" of Win32 programming... Programming Windows by Charles Petzold

dkerr(replace with @ symbol)mindspring.com


back to Index | back to Links