Click here to Skip to main content
15,848,903 members
Please Sign up or sign in to vote.
1.50/5 (4 votes)
See more:
To load a bitmap from resource you normally use one of the below function:

BOOL LoadBitmap(UINT nIDResource);
BOOL LoadBitmap(LPCTSTR lpszResourceName);


To do so, I have folowed the example in this page:
http://www.functionx.com/visualc/bitmaps/DisplayFromResource.htm[^]

I did it using VC 6.0. It has compiled like a charm even when moving the progect to onther computer with VC 6.0 installed, because the Imported .bmp file (resource) becomes part of the project (VC 6.0 made a copy to the res folder of the project).

But, doing the same thing with VS 2012, the project will compile only on the computer where it has been created in (VS 2012 will not make a copy of the .bmp file (resource) in the res folder of the project).

I think that this is a bug., if not so whats wrong with VS 2012 !?

--------------------------------------------------------------------------------
EDIT:

You should take a look at this demo to understand what I mean.

.SWF: http://www.mediafire.com/?pkb2bfokps287ax[^]
--------------------------------------------------------------------------------

Thank you for your understanding.
Posted
Updated 2-Jan-13 16:57pm
v10
Comments
Sergey Alexandrovich Kryukov 30-Dec-12 1:16am    
Not clear. You did not describe your actions.
—SA
Mr. Tomay 2-Jan-13 0:45am    
Re updated my question, you should take a look

Thank you for your understanding.
Sergey Alexandrovich Kryukov 2-Jan-13 0:51am    
Doesn't my answer addresses your problem? Look thoroughly.
—SA
Mr. Tomay 2-Jan-13 0:55am    
Sorry, I am talking about resources by importing them, not "Adding Existing Files" to the project

You should take a look at this demo I uploaded to understand what I mean.
Sergey Alexandrovich Kryukov 2-Jan-13 1:21am    
No, I should not, sorry.
What do you think is the difference between importing and adding is? :-)
Just think about it.
—SA

Warning! OP posted the file which is supposed to contain OP's project. I downloaded the file to see what it is. The files is named as *.EXE and contains the PE executable signature. This is an executable file. Please don't try to run it and, better, don't even download it.

OP is warned about using of unsafe practice of sharing the code. Using an executable file is never needed and is prohibitively unsafe. It's always possible to store file in .ZIP or another archive. Also, most CodeProject members never download inquirers files, for good reasons.

An inquirer is supposed to be able to explain the problem using just the text of the question. Asking questions, as any other activity, also requires certain qualification and has its prerequisites.

Sorry that this is not an answer. I've placed this post just in case, to reduce the possibility of damage in some less experienced members. Running of the file from not a trusted source can easily lead to system infection or infiltration of other malicious software. This is extremely dangerous.

Thank you,
—SA
 
Share this answer
 
v2
Comments
Jibesh 2-Jan-13 1:40am    
Thanks Sergey for the Alert!!!
Sergey Alexandrovich Kryukov 2-Jan-13 1:47am    
My pleasure (and my disgust) :-)
See also the report to abuse watch forum, referenced in my comment to the question above.
—SA
Nelek 2-Jan-13 8:02am    
I think you should edit your very first comment, so the warning and the information you provide is placed near the link at the bottom of the question
Mr. Tomay 2-Jan-13 8:24am    
Don't judge people on their religion, their country or even their SKULL avatar
I have spent many time creating this demo illustration to make you understand my issue, because I am not good in english with just text.

I have created this demo using Instant Demo which gives you the ability to export your demo in many different format including .EXE, so I have choosed the .EXE format with Adobe Flash Player included.Here is its website: http://www.instant-demo.com

Any one who suspect an .EXE file to be malicious may try it inside the SandBox first, and not a quick judgement from the first time.

I have uploaded another file; a .ZIP file that contains the demo in the .SWF format which can be viewed in your web browser by clicking the .HTM file.

So please delete your abuse report about this question.

Thank you for your understanding.
Sergey Alexandrovich Kryukov 2-Jan-13 9:27am    
Look what are you asking about: someone should install a virtual sandbox machine to test something that only you are interested in. Instead of something which you could do very fast. Very nice.

Not only you still don't understand safety practice, but you virtually accused me in something like racism, on totally baseless "arguments".

This is clearly anti-social behavior; and your ignorance about safety practice would make you a potentially dangerous member, sorry to say that.

I'll update my abuse report post.

—SA
Please see my comment to the question. We don't know what exactly you did, but something is wrong here.

First of all, there is no such thing as "res folder of the project". Actually, you can create any folder in your project, and then the sub-directory in the file system will be added. You can copy your external file(s) with your resources there and create a resource file there. If then you add the copy to the resource, there won't be a need in copy of the file; it will remain in the same place. I also don't know what did you mean by "export", but the best way to add some resource (such as image file, for example) is using "Add Existing File". This way, the file will remain a separate file, so you will be able to edit it with any tool. (For example, in particular, as to the image files, Visual Studio is quite a bad editor for them.) Besides, such approach will allow you to add any files of any formats to the resources.

—SA
 
Share this answer
 
Comments
Espen Harlinn 30-Dec-12 8:15am    
5'ed!
Sergey Alexandrovich Kryukov 30-Dec-12 11:51am    
Thank you, Espen.
—SA
Albert Holguin 31-Dec-12 13:28pm    
+5... completely right about VS not always being the right tool for the job.
Sergey Alexandrovich Kryukov 31-Dec-12 13:38pm    
Thank you, Albert.

That's right, but this is not the main point. It's more important to leave a space for maneuver and avoid the vendor lock-in.

The formats of project files and even solutions are not really proprietary. You don't need VS or even any other IDE to build the projects. After all, the project and other source files can be manipulated manually. And the formats are pretty well documented. At the same time, embedding one file of resource (such as image) into another is an extra hassle, referencing it is not.

Happy New Year!

—SA
Albert Holguin 31-Dec-12 14:01pm    
Very true... Happy New Year! :)
It is a bug, confirmed by Visual Studio Product Team

Take a look at here: http://connect.microsoft.com/VisualStudio/Feedback/details/775713[^]
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900