Solved

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

Posted on 2004-08-05
9
364 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
 

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
Do You Know the 4 Main Threat Actor Types?

Do you know the main threat actor types? Most attackers fall into one of four categories, each with their own favored tactics, techniques, and procedures.

 
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

Enabling OSINT in Activity Based Intelligence

Activity based intelligence (ABI) requires access to all available sources of data. Recorded Future allows analysts to observe structured data on the open, deep, and dark web.

Join & Write a Comment

Introduction: Hints for the grid button.  Nested classes, templated collections.  Squash that darned bug! Continuing from the sixth article about sudoku.   Open the project in visual studio. First we will finish with the SUD_SETVALUE messa…
Introduction: Dialogs (1) modal - maintaining the database. Continuing from the ninth article about sudoku.   You might have heard of modal and modeless dialogs.  Here with this Sudoku application will we use one of each type: a modal dialog …
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.
In this seventh video of the Xpdf series, we discuss and demonstrate the PDFfonts utility, which lists all the fonts used in a PDF file. It does this via a command line interface, making it suitable for use in programs, scripts, batch files — any pl…

758 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

Need Help in Real-Time?

Connect with top rated Experts

20 Experts available now in Live!

Get 1:1 Help Now