How to load strings and rc_data from a resource file?

This is the forum for miscellaneous technical/programming questions.

Moderator: 2ffat

How to load strings and rc_data from a resource file?

Postby Augusto » Sun Jan 21, 2018 7:11 pm

Hi friends!

I have created successfully a resource file (.res) including some bitmaps, strings and a rc_data.
The linker doesn't give me errors.
I have found a way to load Bitmaps with success. Example:
Code: Select all
Image1->Picture->Bitmap->LoadFromResourceName((unsigned int)HInstance, L"IMAGE91");

Where can I found a good example about strings and rc_data instead?
Augusto
Active Poster
Active Poster
 
Posts: 10
Joined: Sun Jan 14, 2018 2:40 pm

Re: How to load strings and rc_data from a resource file?

Postby rlebeau » Mon Jan 22, 2018 1:51 pm

Augusto wrote:Where can I found a good example about strings and rc_data instead?


For resource strings, the AnsiString and UnicodeString classes have various LoadStr() and LoadString() methods.

For RCDATA, you can use TResourceStream (which is what TBitmap::LoadFromResource...() uses internally).
Remy Lebeau (TeamB)
Lebeau Software
User avatar
rlebeau
BCBJ Author
BCBJ Author
 
Posts: 1544
Joined: Wed Jun 01, 2005 3:21 am
Location: California, USA

Re: How to load strings and rc_data from a resource file?

Postby Augusto » Mon Jan 22, 2018 4:24 pm

Hi Lebeau!
rlebeau wrote:For resource strings, the AnsiString and UnicodeString classes have various LoadStr() and LoadString() methods.

The first method is more simple to use and it works fine.

rlebeau wrote:For RCDATA, you can use TResourceStream (which is what TBitmap::LoadFromResource...() uses internally).

I have found an example of TResourceStream in the Help of C++ Builder and it works well.

Thank you,
Augusto.
Augusto
Active Poster
Active Poster
 
Posts: 10
Joined: Sun Jan 14, 2018 2:40 pm


Return to Technical

Who is online

Users browsing this forum: Bing [Bot] and 3 guests