Click to See Complete Forum and Search --> : Where to start building a VC++ App
morphman2000
Jan 16th, 2001, 12:52 PM
I'm trying to learn C/C++ and VC++. But With VC++, I don't know where to start or what to do.
My biggest problem here is that my mind is set on Visual Basic... :D
(For example, how can I show the text of ,in vb called, textbox in a MessageBox?)
And a lot more....
So, can anybody help me?
tnx and greetz,
mØrPh
Vlatko
Jan 16th, 2001, 01:45 PM
No, no. Don't start with window applications right away. It is a mistake. First you will need to learn the C++ keywords, language structure, pointers and then start windows programming. First go get some tutorials or books then go file->new->win 32console application->simple "hello world" application to see what is happening.
Remember that this is not VB, so you can not larn C++ from the Help. Get some books. Here are some online free books.
Sites:
http://www.cplusplus.com
http://www.strath.ac.uk/CC/Courses/NewCcourse/ccourse.html
http://www.aul.fiu.edu/tech/visualc.html
http://www.gator.net/~garyg/C/cref.html
Books:
"Thinking in C++"
http://www.codecuts.com/codecuts/pdfs/bruceeckel/TIC2Vone.pdf
http://www.codecuts.com/codecuts/pdfs/bruceeckel/TIC2Vtwo.pdf
http://www.itknowledge.com/reference/archive/0672310708/ewtoc.html
http://newdata.box.sk/bx/c/
For your question how can I show the text of ,in vb called, textbox in a MessageBox,here it is . But as i said learn C++ first then Windows programming.
#include <windows.h>
long fl = SendMessage(secdlge,WM_GETTEXTLENGTH,0,0);
fl++;
TCHAR *ft = new TCHAR[fl];
SendMessage(edithwnd,WM_GETTEXT,fl,(LPARAM)ft);
MessageBox(hWnd,ft,"Title",MB_OK);
First:
I recomend you start programming DOS Consoles first, it's a lot easier, after that, you can start to get into windows programming.
the first program people usually write is a simple "Hello world" program.
#include <iostream.h>
using namespace std;
int main()
{
cout << "Hello World";
return(0);
}
lets break the code up
#include <iostream>
you are telling the compiler to "put iostream here". iostream means Input Output Stream.
using namespace std;
all STL(standard type library) functions are enclosed in namespaces, which contain the code. Another thing, the STL headers don't have .h after them, and usually start with c(cstring, cstdio, cstdlib, etc).
rather than doing this throughout the program:
std::cout << "Hello World";
you just use the entire namespace(which happens to be called std).
int main()
this is how all DOS Console programs start. This executes before anything else.
{
this starts a function, it can also start a block of code, ex:
int main()
{
cout << "hello world";
{
cout << "inside some braces";
}
}
In that way, it is pretty useless, but when you use if statements, for loops, while loops, etc.. it can be useful for executing a block of code, rather than just one line.
cout << "Hello World";
cout means Console Out, and you are using the insertion operators to "insert the string hello world into the console".
every statement in C++ ends with a semi colon, all except for function definitions(well, there is an exception, when you prototype, you use a semi colon), and preproccesor directives(such as #include, #define, #pragma, etc).. the reasons those don't end with semi colons is they aren't really statements.
return(0);
tells the compiler "hey everything went Ok, we can leave now!". this ends every function unless declared as void(returns nothing).
}
this ends a function, or a block of code.
if you understand that Ok, then go to
http://www.itknowledge.com/reference/archive/0672310708/ewtoc.html
it's sams teach youself C++ in 21 days(the book) online...
morphman2000
Jan 16th, 2001, 03:24 PM
Tnx all,
Had wrote some console apps before, so knew some of that allready....
But tnx again.... All usefull info!
greetz,
mØrPh
wey97
Jan 25th, 2001, 09:57 PM
Dennis:
Good job.
Also, classes end w/ semicolons.
Ex:
class Node {
int data;
Node *next;
public:
Node() : data(0), next(0) {}
Node(int e) : data(e), next(0){}
Node(int e, Node *ptr) : data(e), next(ptr){}
friend ostream& operator << (ostream&, const Node&); //Prototype Only!
};
samwise
Jan 31st, 2001, 02:54 PM
After you learn C++, an excellent book for learning Windows programming is "Programming Windows" by Charles Petzold.
Samwise Galenorn
sam@galenorn.com
vbforums.com
Copyright Internet.com Inc., All Rights Reserved.