Solved

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

Posted on 2004-08-05
9
369 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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
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!

 

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 500 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

On Demand Webinar - Networking for the Cloud Era

This webinar discusses:
-Common barriers companies experience when moving to the cloud
-How SD-WAN changes the way we look at networks
-Best practices customers should employ moving forward with cloud migration
-What happens behind the scenes of SteelConnect’s one-click button

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
ORA-01403: no data found 43 116
Excel Use VBA to get user's Mac Address for their computer 5 414
Hibernate methods 2 88
wordappend challenge 8 249
This is to be the first in a series of articles demonstrating the development of a complete windows based application using the MFC classes.  I’ll try to keep each article focused on one (or a couple) of the tasks that one may meet.   Introductio…
Introduction: Displaying information on the statusbar.   Continuing from the third article about sudoku.   Open the project in visual studio. Status bar – let’s display the timestamp there.  We need to get the timestamp from the document s…
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.
How to Install VMware Tools in Red Hat Enterprise Linux 6.4 (RHEL 6.4) Step-by-Step Tutorial
Suggested Courses

751 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