Help me!!!!

Started by
14 comments, last by Aardvajk 17 years, 12 months ago
I'm learning to program using Blocks but the book I'm learning from tells me to put: //register the class MyRegisterClass(hInstance); and when I try to build it tells me that It is undeclared and that I need to use some function Help!!!!
Advertisement
Hey, ya know, start 9 or 10 user accounts and ask the same question. And when you get an answer, ask again anyway under a different name.

That's ridiculous, dude.
the other guy is my friend, we r doing it together and we got stuck in the same place.
MyRegisterClass() is not a function of the WinAPI. You have to write it. If you wrote it and you code looks like this one:

func1(){  // here, I use MyRegisterClass()  if (!MyRegisterClass(hinstance)) { // error: MyRegisterClass is undeclared    ...  }}bool MyRegisterClass(HINSTANCE hinstance) // MyRegisterClass definition{}


Then you broke one of the basic rule of C++ which is: I can't use something that hasn't been declared yet. Put the declaration of MyRegisterClass() at the top of your file and it should run:
bool MyRegisterClass(HINSTANCE hinstance); // MyRegisterClass declarationfunc1(){  // here, I use MyRegisterClass()  if (!MyRegisterClass(hinstance)) { // MyRegisterClass is declared    ...  }}bool MyRegisterClass(HINSTANCE hinstance) // MyRegisterClass definition{}

HTH
If so, then he already asked. Why ask again?

The anonymous poster in Chip Holder's thread is me. Another poster and I answered your question there.

[addendum] And thank you, Emmanuel, for explaining it in code for them. Apologies that I didn't do it, myself.
Chip holder put the code you said on the top, and it said

ISO C++ forbids declaration of 'func1' with no type

what does that mean??
I put in MyRegisterClass in the parantheses at the top and it says:

expected constructor, destructor, or type conversion before '(' token

can you explain please?
AjM&*SoG
Well, that's just an example. Try 'void func1()' if you want.
we r going t try it.
by the way ,
what does that mean
void etc. etc.
AjM&*SoG

This topic is closed to new replies.

Advertisement