Jump to content
  • Advertisement

Archived

This topic is now archived and is closed to further replies.

ZomeonE

Help me please!

This topic is 6906 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Guest Anonymous Poster
wndclass.hbrBackground = GetStockObject((HBRUSH__*)BLACK_BRUSH);

Share this post


Link to post
Share on other sites
Advertisement
ok, thanx but now i get the following problem:

Linking...
LIBCD.lib(crt0.obj) : error LNK2001: unresolved external symbol _main
Debug/OpenWindow.exe : fatal error LNK1120: 1 unresolved externals
Error executing link.exe.

???

Share this post


Link to post
Share on other sites
I'm probably well wrong but it sounds like you may have your project trying to build a Console app. Main is the entry point used by DOS apps. I think VC++ uses this as default if you just loaded the c,cpp file and then let it create the project for you.

try creating a new blank Win32 project and add your existing file to that and then try again.

[This message has been edited by STG (edited October 20, 1999).]

Share this post


Link to post
Share on other sites
Just for code readability, you might want to use the more standard cast below:

wndclass.hbrBackground = (HBRUSH)GetStockObject(BLACK_BRUSH);

In fact, I don't see how the other code even works. BLACK_BRUSH is an integer, and doesn't need to be cast, since GetStockObject takes an integer as its only parameter . The fact that GetStockObject returns fonts, brushs, pens, etc. is the reason why it has to be cast.

- Splat

Share this post


Link to post
Share on other sites
Your right about that

wndclass.hbrBackground = (HBRUSH)GetStockObject(BLACK_BRUSH);

is the only thing that works, but why does every piece of code that I look at write:

wndclass.hbrBackground = GetStockObject(BLACK_BRUSH);

???

Share this post


Link to post
Share on other sites
This code only works with VC 5.0 and older versions.

CU

------------------
Skullpture Entertainment
#40842461

Share this post


Link to post
Share on other sites
NuFAN: I don't think so, the code works in every version. In either version 4 I used to use, and in version 6 I use at the moment.

------------------
Dance with me......

Share this post


Link to post
Share on other sites
When i try to make a window in Visual C++ 6 i get a error using the following line:

wndclass.hbrBackground = GetStockObject(BLACK_BRUSH);

The error:

error C2440: '=' : cannot convert from 'void *' to 'struct HBRUSH__ *'
Conversion from 'void*' to pointer to non-'void' requires an explicit cast

please help me solve this problem!

Share this post


Link to post
Share on other sites
Here's what I get without casting:


c:\pware\arcgfx\arctest\mainwin.cpp(55) : error C2440: '=' : cannot convert from 'void *' to 'struct HBRUSH__ *'
Conversion from 'void*' to pointer to non-'void' requires an explicit cast

VC 6 does not automagically cast things like this for you. 5 and under do.

Share this post


Link to post
Share on other sites

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!