Need help with GUI programing! - Programmers Heaven

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Categories

Need help with GUI programing!

Hi
I'm a newbee to windows graphic programming and i have bought a book called Windows game programming for dummies.
And it is really good, except for one little problem.
Some of the directx example files wont compile for me :(
Have tried both borland 5.02 and visual c++ 6.0.
The problem is the same each time in a number of diffrent files

\c++gpchap12starferr.cpp(216) : error C2440: '=' : cannot convert from 'void *' to 'struct HBRUSH__ *'
Conversion from 'void*' to pointer to non-'void' requires an explicit cast
?? this line is giving me a bit of an hedace, what is wrong...
plz help me!

Comments

  • gautamgautam Posts: 642Member
    : Hi
    : I'm a newbee to windows graphic programming and i have bought a book called Windows game programming for dummies.
    : And it is really good, except for one little problem.
    : Some of the directx example files wont compile for me :(
    : Have tried both borland 5.02 and visual c++ 6.0.
    : The problem is the same each time in a number of diffrent files
    :
    : \c++gpchap12starferr.cpp(216) : error C2440: '=' : cannot convert from 'void *' to 'struct HBRUSH__ *'
    : Conversion from 'void*' to pointer to non-'void' requires an explicit cast
    : ?? this line is giving me a bit of an hedace, what is wrong...
    : plz help me!
    :

    Thats because it has to be typecasted to type HBRUSH
    Edit that line and make it (HBRUSH)GetStockObject(whatever_here);
    Just add (HBRUSH) and nothing else, then compile.


  • elfishelfish Posts: 6Member
    : Thats because it has to be typecasted to type HBRUSH
    : Edit that line and make it (HBRUSH)GetStockObject(whatever_here);
    : Just add (HBRUSH) and nothing else, then compile.
    :
    :


    It worked!
    Tanx a lot!!!

  • elfishelfish Posts: 6Member
    got some more problems...

    HDC hdc; // generic dc
    PAINTSTRUCT ps; // generic paintstruct



    c++SourceGpchap9Prog9_1.cpp(127) : warning C4101: 'ps' : unreferenced local variable

    c++SourceGpchap9Prog9_1.cpp(126) : warning C4101: 'hdc' : unreferenced local variable

    hope you can help me as easy as the last one :)

  • gautamgautam Posts: 642Member
    : got some more problems...
    :
    : HDC hdc; // generic dc
    : PAINTSTRUCT ps; // generic paintstruct
    :
    :
    :
    : c++SourceGpchap9Prog9_1.cpp(127) : warning C4101: 'ps' : unreferenced local variable
    :
    : c++SourceGpchap9Prog9_1.cpp(126) : warning C4101: 'hdc' : unreferenced local variable
    :
    : hope you can help me as easy as the last one :)
    :
    Those are warnings because those 2(ps & hdc) are never used in the whole program. You don't have to worry about it. If its concerning you too much then you can comment the two.

Sign In or Register to comment.