?
Solved

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

Posted on 2004-08-05
9
Medium Priority
?
371 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
Will your db performance match your db growth?

In Percona’s white paper “Performance at Scale: Keeping Your Database on Its Toes,” we take a high-level approach to what you need to think about when planning for database scalability.

 

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

Learn how to optimize MySQL for your business need

With the increasing importance of apps & networks in both business & personal interconnections, perfor. has become one of the key metrics of successful communication. This ebook is a hands-on business-case-driven guide to understanding MySQL query parameter tuning & database perf

Question has a verified solution.

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

Have you tried to learn about Unicode, UTF-8, and multibyte text encoding and all the articles are just too "academic" or too technical? This article aims to make the whole topic easy for just about anyone to understand.
In this post we will learn different types of Android Layout and some basics of an Android App.
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.
This tutorial will teach you the special effect of super speed similar to the fictional character Wally West aka "The Flash" After Shake : http://www.videocopilot.net/presets/after_shake/ All lightning effects with instructions : http://www.mediaf…

719 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