Go Back  Xtreme Visual Basic Talk > Legacy Visual Basic (VB 4/5/6) > General > adding image to .exe file


Reply
 
Thread Tools Display Modes
  #1  
Old 05-30-2001, 11:34 AM
johnjr
Guest
 
Posts: n/a
Question adding image to .exe file


hi all......how would one add a .bmp image into a .exe file sothat its part of the .exe file and not a seperate file.
ps...the image would be loaded onto a picture box control on a form.

thanks


john

Reply With Quote
  #2  
Old 05-30-2001, 11:57 AM
BillSoo's Avatar
BillSoo BillSoo is offline
Code Meister

Retired Moderator
* Guru *
 
Join Date: Aug 2000
Location: Vancouver, BC, Canada
Posts: 10,441
Default Re: adding image to .exe file

Just load the image into the picturebox at design time.

"I have a plan so cunning you could put a tail on it and call it a weasel!" - Edmund Blackadder
__________________
"I have a plan so cunning you could put a tail on it and call it a weasel!" - Edmund Blackadder
Reply With Quote
  #3  
Old 05-30-2001, 12:52 PM
ANUNEZ
Guest
 
Posts: n/a
Default Re: adding image to .exe file

You can also use the imagelist control if you need to change the images a runtime. You save all the images in the control and then use it in your program.
The images must be saved a design time.

Reply With Quote
  #4  
Old 05-30-2001, 02:08 PM
JDT JDT is offline
Original Contributor

Retired Moderator
* Guru *
 
Join Date: Jan 2001
Location: Watch Window
Posts: 2,781
Default Re: adding image to .exe file

You can also use a resource file that will become part of the exe.

JDT

__________________
JDT
Reply With Quote
  #5  
Old 05-30-2001, 02:45 PM
johnjr
Guest
 
Posts: n/a
Default Re: adding image to .exe file

hi guys....i am not sure you understand what i want to do.at the moment i have a .bmp pic which is loaded at runtime into a picturebox control.the pic is thus viewable and changeable by all.what i want to do is to incorporate the .bmp pic into the main .exe fole sothat it cant be got at and viewed easily outside of the prog.

thanks guys


john


Reply With Quote
  #6  
Old 05-30-2001, 02:48 PM
JDT JDT is offline
Original Contributor

Retired Moderator
* Guru *
 
Join Date: Jan 2001
Location: Watch Window
Posts: 2,781
Default Re: adding image to .exe file

I believe all three suggestions will do that.

JDT

__________________
JDT
Reply With Quote
  #7  
Old 05-30-2001, 03:08 PM
BillSoo's Avatar
BillSoo BillSoo is offline
Code Meister

Retired Moderator
* Guru *
 
Join Date: Aug 2000
Location: Vancouver, BC, Canada
Posts: 10,441
Default Re: adding image to .exe file

The loadable at runtime part is easy. For instance, if you put the image into an imagelist, you can copy it from the list to your control at runtime.

The changable part is a bit more problematic. Are you saying you wish to allow the users to modify the bitmap, ie add lines or text to it, then save it? Or are you saying you wish to allow users to change one bitmap for another?

If you wish to swap bitmaps, then just pick another image from the image list. But if you wish to SAVE an image in your EXE, then that IS a problem....

Thereoretically, it should be possible to save the new BMP over the old one stored in the RES file in your EXE. But I don't know how to do that yet....Also, it might not be possible for a program to modify it's own resource file.

Another possibility is to store the image in the Registry. It would certainly be more difficult to find...




"I have a plan so cunning you could put a tail on it and call it a weasel!" - Edmund Blackadder
__________________
"I have a plan so cunning you could put a tail on it and call it a weasel!" - Edmund Blackadder
Reply With Quote
  #8  
Old 05-30-2001, 03:14 PM
johnjr
Guest
 
Posts: n/a
Default Re: adding image to .exe file

hi again.....basically the pic is a map,which comprises of squares like a grid,and one can click on each sqaure and paste a color to it ...say red. this map is a .bmp file and is in the app.path folder during runtime.the map can be saved and recalled at any time.i was thinking of placing it inside a dll,but bot sure how to do this.the idea is to make the map accessible only from within the prog and not viewable otherwise.

Reply With Quote
  #9  
Old 05-30-2001, 03:43 PM
BillSoo's Avatar
BillSoo BillSoo is offline
Code Meister

Retired Moderator
* Guru *
 
Join Date: Aug 2000
Location: Vancouver, BC, Canada
Posts: 10,441
Default Re: adding image to .exe file

If it's as simple as you say, then you could make your own file type. You could have the locations (X,y coordinates) of the squares and their colours. This would take up a lot less space than a BMP file, which stores 1 byte per pixel.

But if you wish to save a bmp file anyway, then you should be able to save it to the registry.


"I have a plan so cunning you could put a tail on it and call it a weasel!" - Edmund Blackadder
__________________
"I have a plan so cunning you could put a tail on it and call it a weasel!" - Edmund Blackadder
Reply With Quote
Reply


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off

Forum Jump

Advertisement:





Free Publications
The ASP.NET 2.0 Anthology
101 Essential Tips, Tricks & Hacks - Free 156 Page Preview. Learn the most practical features and best approaches for ASP.NET.
subscribe
Programmers Heaven C# School Book -Free 338 Page eBook
The Programmers Heaven C# School book covers the .NET framework and the C# language.
subscribe
Build Your Own ASP.NET 3.5 Web Site Using C# & VB, 3rd Edition - Free 219 Page Preview!
This comprehensive step-by-step guide will help get your database-driven ASP.NET web site up and running in no time..
subscribe
 
 
-->