C++ simple problem

This is a discussion on C++ simple problem within the C++ Programming forums, part of the General Programming Boards category; Hello.I'm a complete beginner with C++.I've been using the Devbloodshed IDE and running it on Windows XP.
All I've really ...

C++ simple problem

Hello.I'm a complete beginner with C++.I've been using the Devbloodshed IDE and running it on Windows XP.
All I've really run is simple apps with loops and arrrays etc.Anyway,I really want to learn how to
create windows applications.This may sound like a simple error to some:
int *buf = GlobalAlloc(GPTR, sizeof(int) * count);
I receive an invalid convert from void to int error at this line.
I've tried doing a simple cast such as
int *buf =(int) GlobalAlloc(GPTR, sizeof(int) * count);
and tried using dynamic and static casts all to no avail.
What is interesting is this, GlobalAlloc function doesn't have a return,so how can it return anything other than void anyway?
This isn't my application.The exe runs fine,but not when I try to run it in the Ide.
Any help appreciated.I've listed the 1 compilation error in the code with a
//my error comment.

If you don't even know about casting, don't try learning the Win32 GUI API... Do you even know what that function is doing ? It does exactly the same thing as new, except that GlobalAlloc() called with the GPTR parameter will allocate memory from the heap and set it to 0. It looks like you're just following a tutorial and you're copying everything from it without having even a clue what everything means.

For the record, it should be (int*) GlobalAlloc( ... ).

Seriously, you really need to quit learning the Win32 API and learn about pointers and basic topics...

Hey listen buddy.I've been at C++ 2 days.If this is the attitude.
Im going to get on this board then I won't be posting anymore.
Right now I make my living as a php programmer and also
have worked in vb.net.
All I've seen here is a bunch of self rightous twerps not worthy of
#@#@ on!!!

If you don't know the basics of the language, why confuse yourself with advanced concepts that require your knowledge of the language to be pretty solid? That's all you're doing. You're getting confused with simple memory allocation and casting, and such, but you're working on the Windows API. You have to make sure you get the language down right because C++ is much less forgiving than php or VB, whether it's .NET or otherwise.

Just calm down for a second, and vent your frustration in another manner. Maybe take a break, get a nice beverage, and then go back to the details of the language. When it makes sense, go back to the Windows API for a bit.

HY Dynasty!You seem a bit arrogant.I've done Windows API programming in visual basic but it's limited.What I want to do is build 'user interface ' templates quickly in c++ so I can get down to the real programming,which is pure logic.
Running loops or whatever.Connnecting to databases.
I don't see anything wrong with trying to take apart ready made examples as I have.It's a good way to learn,but Dynasty detests such a 'learners' attitude.
I don't think I'll be back on this board again.

Dynasty ? You mean... Desolation ? Look, we're not putting you down. We're just telling you that you're shooting yourself in the foot by doing so. VB and PHP are nothing alike C++. PHP may have a similar syntax, but C++ is much harder than PHP and like McGyver said, "C++ is much less forgiving than php or VB, whether it's .NET or otherwise".

Hey listen buddy.I've been at C++ 2 days.If this is the attitude.
Im going to get on this board then I won't be posting anymore.
Right now I make my living as a php programmer and also
have worked in vb.net.
All I've seen here is a bunch of self rightous twerps not worthy of
#@#@ on!!!