Solved

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

Posted on 2004-08-05
9
366 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
ScreenConnect 6.0 Free Trial

Discover new time-saving features in one game-changing release, ScreenConnect 6.0, based on partner feedback. New features include a redesigned UI, app configurations and chat acknowledgement to improve customer engagement!

 

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

Netscaler Common Configuration How To guides

If you use NetScaler you will want to see these guides. The NetScaler How To Guides show administrators how to get NetScaler up and configured by providing instructions for common scenarios and some not so common ones.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
How to calculate times for developing software? 8 67
sumDigits challenge 9 149
sumNumber challenge 16 122
Message not shown 5 50
Introduction: Finishing the grid – keyboard support for arrow keys to manoeuvre, entering the numbers.  The PreTranslateMessage function is to be used to intercept and respond to keyboard events. Continuing from the fourth article about sudoku. …
Introduction: Dialogs (2) modeless dialog and a worker thread.  Handling data shared between threads.  Recursive functions. Continuing from the tenth article about sudoku.   Last article we worked with a modal dialog to help maintain informat…
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.
Microsoft Active Directory, the widely used IT infrastructure, is known for its high risk of credential theft. The best way to test your Active Directory’s vulnerabilities to pass-the-ticket, pass-the-hash, privilege escalation, and malware attacks …

773 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