MS VC++: Theres Absolutely no way to learn......

Pages: 12
I have searched far and wide for some sort of tutorial (not video), or reference 'encyclopedia' on how to use Microsoft's Visual C++ and have found absolutely nothing. I'm talking about Basics here. Not Basics, but MSVC++ Basics, like "how to get the string from a text box" basic. Like "How to change the name of a label when a button is clicked" basic. Like "How to change the name of a window, and create other objects when a button is pressed, and specific text is entered" basic. Not "how to make a network", or "how to make a consol program", or "hello world!", or all the other crap I found. It seems there is a distinct gap in between MSVC++ and their related object's arguments (you know, the arguments used to control them), the complexities of professional tasks, and the simplicity of the basics of C++ in general.

I haven't found anything to help me get that string that my text box is supposed to get, or change the properties of a VC++ object (like a label) at the press of a button (like 'enter' makes lebel1 != absolutely nothing...).

Is there anyone here wiling to help me out so I can get started? It feels as though MS wants me to go to college before I'm even able to use their program...

edit1 -

I'm using MS VC++ (Microsoft Visual C++). I just went to the MS website and got the MSVC++ 2010 Express.
Last edited on
Are you using Win32 or the drag and drop form designer?
I can think of a few possible replies to your rambling quandry IWishIKnew. For example....

"Yes! Its hard! That's why we make the big bucks!"

Or,

"The younger generation doesn't know the meaning of work. All the things you want to know you want to have them spoon fed to you rather than struggling yourself to learn them like we all had to do."

Or even,

"That's why I prefer to use a lighter weight IDE such as Code::Blocks, or even command line compiling, because Visual Studio is such a brute and bloated pig. Believe it or not, I even found a book on Amazon.com that explains how to use Visual Studio. Not how to program, mind you, but how to use the IDE. I think its pretty bad when you need a book to explain how to use an IDE, I mean, IDEs were supposed to help in coding, not hinder."

But let's leave it at naraku's question.
I always used the common C functions also in C++ programs, I don't find MSVC++ so hard "this way", and I mean RegisterClass/CreateWindow/GetMessage or DialogBox and the common WNDPROC/DLGPROC. No one forces you to use MFC/ATL. The only bad thing is the buggy IntelliSense.

PS: I also found useful a old Win32.hlp which contained the offline docs for ASM and C. It's rare and really useful - But outdated. Still this may explain you many things like SendMessage or GetDlgItemText. And let me say there is a big difference from a VC++-Designed Form and a "Raw" CreateWindow window. So we'd like to know which way you want to use.
Last edited on
I'm with freddie on this one. Why does everyone feel the need to have a tutorial and spoon fed code to learn anymore? What's wrong with just reading the available documentation and learning on your own? I remember not too long ago that was the only option...
What you need to do is learn how to program for Microsoft Windows, and you'll be surprised that it has nothing to do with MS Visual Studio.

What will be helpful to you is to understand how Windows applications work and how Windows drives them, meaning: Windows messages. Learn about how all user interfaces are composed of windows and you'll be one step closer. Learn how to get information by means of window messages and you'll be right there.

But know something: You should know C before you learn Windows Programming. Otherwise you'll start thinking it is Microsoft's fault that you have to do so much to get so little done when it is not.

And yes, it takes a while. It is hard to start with this, but hopefully once you start you'll cruise (kinda).

Are you using Win32 or the drag and drop form designer?


Real Programmers do the former!
hehe, funny how freddie1's answer moves along as generations move. That's what "real programmers" said about strongly-typed programming languages some decades ago. "Real programmers don't need the machine to tell him where the integer begins or where the text begins. Real programmers work with byte offsets!".

What do you think will be the target for this phrase in 40 years? I bet it will be "Real programmers drag and drop, don't dictate!".
@freddie1

Do not insult my intelligence by calling me a child. I will be attending college in the coming semester, but in the mean time, I find it more productive to learn more about the windows API, than to sit around playing video games all day. I would thank you to answer me, instead of posting un-helpful comments about irrelevant subjects.
----------------

I have searched and searched and searched and only to find irrelevant junk. Yes, there are PLENTY of tutorials, and sample codes, but they do not help me if I can not understand them. Also, 70-90% of them aren't even related. They show you how to 'write a program', or how to 'use directx' etc... I'm looking for a resource website, not tutorials. I'm looking for a place like http://www.cplusplus.com/reference/
but for MSVC++. I know MSVC++ doesn't technically use C++, which is why I'm looking for a reference website. My next step (once I understand the basics, like how to program a button's action) will be to follow up on what I already know. I have been programing DOS for about a year. I should think I'm ready for GUIs.
The first step though is finding the answer to this question: How can i make objects (buttons, textboxes, etc...) do somthing? How can i retrieve the text from the textbox, change a label, etc........

Now that I have made it clear that I'm not a little script kiddie, hellbent on writing a hopless PE or some other BS, I will tell you:

yes, I suppose I should start with MSVC++' drag and drop crap to learn the basics. Once I can get that, I will be better able to do it outside of VC (yes, i study code, not just write it off the bat...).
_______________
on another note:
@ webhose
It wont be. It will program itself!! (*o*) lol
"Real programmers tell the computer what they want, they don't bother with the 'ifs, thens, and elses!"
Last edited on
Here are some C++/CLI tutorials, I don't hate CLI like so many others do. I find it useful for building a quick and dirty GUI, although mixing managed and unmanaged code can be tricky but it is possible. With that said I still prefer C# when using .Net

http://www.functionx.com/cppcli/index.htm
http://www.codeproject.com/Articles/19354/Quick-C-CLI-Learn-C-CLI-in-less-than-10-minutes

More links here http://www.google.com/search?q=c%2B%2B+cli+tutorial&rlz=1C1GGGE_enUS436US488&aq=0&oq=c%2B%2B+cli+tut&sugexp=chrome,mod=0&sourceid=chrome&ie=UTF-8
Thank you Naraku, I will look into that. I suppose that is the 'coded' way (for lack of a better term) of doing it? I mean like, it isn't Microsoft Visual Drag/drop.
OMG!! Check this out, I found a would-be answer, but click on the link on this page....

http://msdn.microsoft.com/en-us/library/aa733753%28v=vs.60%29.aspx

PAGE NOT FOUND...

I'm holding back so many bad words right now..... seriously, that's just my luck.

>,<
http://msdn.microsoft.com/en-us/library/aa232254%28v=VS.60%29.aspx
Boy, that was hard. This seems to be from 1998, though.
@helios
I appreciate the help, but that is about the program, not programming... I'm talking about making the dam buttons/textboxes/checkboxes etc... work, which I havn't found out how to do yet....

Text->label_text_box_label = "I'm about to give up on this";
Doesn't compile... "not a system::string" w.e....

Yes, i did name the label.... w.e...
Last edited on
oh... You know what? I think I know what I need:

I believe it's called "windows forms"? I'm just trying to make a GUI.
WebJose:

You might like this one I've seen somewhere ...

"Real programmers use a magnetized needle and a steady hand"

IWishIKnew:

I've done my best to help new folks over the years. Here is a link to a tutorial series I've written that some have found useful ...

http://www.jose.it-berater.org/smfforum/index.php?topic=3389.0

If you need to know how to start a Visual Studio Win32 C++ project, I'd be glad to help (I only have VS 2008 Pro though). Likewise with such mundane things as getting/setting text in/out of a text box or putting buttons in a window/dialog. Or whatever.

I'm just trying to spark a little fire in this forum. It seems overly dry to me!

Assuming a text box named textBox1 you can set the text with textBox1->Text = L"some text";
"how to get the string from a text box"

1
2
3
4
5
std::string Text;
int TextLen = SendMessage(TextBoxHandle, WM_GETTEXTLENGTH, 0, 0);    //Get length of text in box.
++TextLen;    //GETTEXTLENGTH doesn't include terminating null
Text.resize(TextLen);
SendMessage(TextBoxHandle, WM_GETTEXT, TextLen, &Text[0]);    //Copy text into string 


"How to change the name of a label when a button is clicked"

1
2
3
4
5
6
7
case WM_COMMAND:
    if (LOWORD(wParam) == ID_BUTTONEXAMPLE)
    {
        SendMessage(LabelHandle, WM_SETTEXT, 0, "Example button clicked.");
        //Alternatively, see next example.
    }
    break;


"How to change the name of a window..."

1
2
//This actually just calls the above SendMessage call, just a lil shorter n cleaner.
SetWindowText(WindowHandle, "New caption here plz.");


"and create other objects when a button is pressed, and specific text is entered"

1
2
3
4
5
6
7
8
9
10
11
12
13
if (stricmp(EnteredTextasCString, "TargetText") == 0)
{
    //Strings match, case insensitive
    CreateWindowEx(0,    //Extended styles
        "Button",    //Class name
        "Created button!",    //New control's 'label'
        WS_STYLESYOUWANT | WS_CHILD,    //Style flags, make sure to include WS_CHILD
        X, Y, Width, Height,    //Obvious
        ParentWindowHandle,    //HWND var holding handle to parent window
        (HMENU)ID_NEWBUTTON,    //Have to assign a unique ID to the control for later message processing
        GetModuleHandle(0),    //Associate it with this module
        0);    //Additional params for WM_CREATE message sent to window, rarely used
}


"at the press of a button"

1
2
3
4
5
6
case WM_KEYDOWN:
    if (wParam == VK_RETURN)
    {
        SetWindowText(LabelHandle, "Text");
    }
    break;


//-------------------------------------------------------------

Don't bother with libraries, they're too complicated. Just get the Windows SDK and dig through all the WM_* entries. Much more educational and in my opinion much simpler and cleaner. Try this for a tutorial to start you off:
http://www.winprog.org/tutorial/start.html
yes, I suppose I should start with MSVC++' drag and drop crap to learn the basics. Once I can get that, I will be better able to do it outside of VC (yes, i study code, not just write it off the bat...).


You need to understand this:

If you use MSVC drag & drop interface you will use an entirely different programming language, not C, not C++, but C++/CLI, ehich means you need to learn C++/CLI syntax and rules and no C or C++ tutorial will help you

There are resource editors for win32api directly (if you stick with C or C++ language) for dialogs like ResEdit. This is what you really need if you choose C or C++ programming language.
Thank you mordoran. I think I will dump MSVC++ then, because this Timer program (which was supposed to be incredibly simple!) is being a pain in the *** to figure out...
Pages: 12