Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

How do I make a jpeg or gif a resouce in VC++?

Posted on 2004-08-05
9
Medium Priority
?
373 Views
Last Modified: 2013-11-20
Insert resource gives me a view of the resource file as text.  How is it included similar to a bitmap so that I can refer to it using a string?

Thanks.
0
Comment
Question by:jasoncpp
  • 5
  • 4
9 Comments
 
LVL 55

Expert Comment

by:Jaime Olivares
ID: 11730816
Could you clarify please?
0
 

Author Comment

by:jasoncpp
ID: 11731123
What's the equivalent to this?

A_IMG BITMAP A.bmp

To make a gif image a resource.  I wish to use something like this to load the image

CBitmapPicture Picture;
if(Picture.Load(IDR_GIF1,"GIF"))
m_Display.SetBitmap((HBITMAP)Picture.GetSafeHandle());

Thanks
0
 
LVL 55

Expert Comment

by:Jaime Olivares
ID: 11731402
no equivalent exists, but you could insert your gif as a "user defined resource":

B_IMG   GIF    B.gif    <--- GIF is not a standard resource type

You can load gif into memory with FindResource() and LoadResource(), but you will need some library to convert gif image in a bitmap to let CBitmapPicture to use it.
0
Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

 

Author Comment

by:jasoncpp
ID: 11731449
>>no equivalent exists, but you could insert your gif as a "user defined resource":

What do I have to do to achieve this?
0
 
LVL 55

Expert Comment

by:Jaime Olivares
ID: 11731472
Just write directly in your .rc file

If you are using Visual C++,  go to  ResourceView, press right button, "Import...", change to "all files" to view your files, select it, and choose "Custom" at the "Open" combobox at the bottom of this dialog. Then VC++ will ask you for "data type" and type "GIF". That's all, now you can load it with FindResource/LoadResource. To avoid problems, use UPPERCASE in your filenames and resource type.
 
0
 

Author Comment

by:jasoncpp
ID: 11731527
My resource file is viewed as text only.  How can I change the view from text to the view you mention?  In the Resource View it says "Load failed", but I can edit the resource file manually as text?
0
 
LVL 55

Expert Comment

by:Jaime Olivares
ID: 11731534
> In the Resource View it says "Load failed", but I can edit the resource file manually as text?
That means you have altered it and Visual C++ can't parse it correctly, bad news.
0
 

Author Comment

by:jasoncpp
ID: 11731571
Listen, I type in the resource file statements directly into the resource file as text, do you know how to switch it back to the regular view?
0
 
LVL 55

Accepted Solution

by:
Jaime Olivares earned 2000 total points
ID: 11731619
Listen, I type in the resource file statements directly into the resource file as text, do you know how to switch it back to the regular view?
It is not a matter of "switching", as far as I can understand, you have corrupted your RC file, so maybe you can create a new project and paste all your code and resources, or simply try to remove all you have typed manually in your resource file.
Also try to delete your .res file in your "Debug" or "Relese" directory.
0

Featured Post

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Introduction: Database storage, where is the exe actually on the disc? Playing a game selected randomly (how to generate random numbers).  Error trapping with try..catch to help the code run even if something goes wrong. Continuing from the seve…
Ready to get certified? Check out some courses that help you prepare for third-party exams.
This video will show you how to get GIT to work in Eclipse.   It will walk you through how to install the EGit plugin in eclipse and how to checkout an existing repository.
Please read the paragraph below before following the instructions in the video — there are important caveats in the paragraph that I did not mention in the video. If your PaperPort 12 or PaperPort 14 is failing to start, or crashing, or hanging, …
Suggested Courses
Course of the Month10 days, 18 hours left to enroll

885 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question