Board index » cppbuilder » about the handle of Tbitmap (help help)

about the handle of Tbitmap (help help)

I define a tbitmap in a .h file.
        Graphics::TBitmap *Pict;
the is the program:

   Pict=new Graphics::TBitmap();
   Pict->LoadFromResourceName(HInstance,"HeroTimon");               //
error at here

//   herotimon is at a resouce file (heroes.rc)
when I complie the program,a error happen:
C++ builder tell me:

[C++ Error] tes.cpp(22): E2034 Cannot convert 'void *' to 'unsigned int'.
[C++ Error] tes.cpp(22): E2343 Type mismatch in parameter 'Instance' in call
to '_fastcall TBitmap::LoadFromResourceName(unsigned int,const AnsiString)'.

 

Re:about the handle of Tbitmap (help help)


that's just a documentation mistake. the help file gives wrong info...

try this instead:

        Pict->LoadFromResourceName((int)HInstance,"HeroTimon");
                                   ^^^^^

you can alternatively use the API call "LoadBitmap()" which gives you a
HBITMAP handle (TBitmap's Handle property).

T.

Other Threads