Packaging Image Files in the Installer

  • Thread starter Thread starter jcrouse
  • Start date Start date
J

jcrouse

I saw an article, once, on how to package image file in the installer so
they are not accessible to the end user. I want to say hidden, but I don't
just mean the file attribute of the image file. Does anyone know of the
article I'm speaking of or a link on how to embed (another poor choice of
words) the image files in the executable?

Thanks,
John
 
* "jcrouse said:
I saw an article, once, on how to package image file in the installer so
they are not accessible to the end user. I want to say hidden, but I don't
just mean the file attribute of the image file. Does anyone know of the
article I'm speaking of or a link on how to embed (another poor choice of
words) the image files in the executable?

Description of the necessary steps for embedding an icon file, other
image formats will work similar:

Add the icon file to your project and set its 'Build Action' property to
'Embedded Resource'. You can use the code below to load the icon at
runtime:

\\\
foo.Icon = _
New Icon( _
[Assembly].GetExecutingAssembly().GetManifestResourceStream( _
"WindowsApplication1.Ball.ico" _
) _
)
///

'WindowsApplication1' is the root namespace of the application, "Ball.ico"
is the icon's filename.
 
Currently this is the way I have things setup. I have an installer in my
project. I added a folder to the installer package and added all of the
image files to the installer package folder. I the declare the in the code
and then call them.

Dim myImage as New Bitmap(Application.StartupPath & "\Images")
PictureBox.Image = myImage

When I embed the in the executable and then remove them for the installer
package folder, how do I then reference them in my code? Also, should they
be disposed of when the form is closed and the image is no longer being
used. I'm talking about fifty or sixty images here and am concerned with
system resource usage.

On a side note. I also have my icon files and banner images for the
installer package in the same above mentioned folder. How do I embed them.
The properties page in the dialog boxes of the installer package seems to
only allow yout o look in the folder you have setup in the installer
package.

Thank you,
John


Herfried K. Wagner said:
* "jcrouse said:
I saw an article, once, on how to package image file in the installer so
they are not accessible to the end user. I want to say hidden, but I don't
just mean the file attribute of the image file. Does anyone know of the
article I'm speaking of or a link on how to embed (another poor choice of
words) the image files in the executable?

Description of the necessary steps for embedding an icon file, other
image formats will work similar:

Add the icon file to your project and set its 'Build Action' property to
'Embedded Resource'. You can use the code below to load the icon at
runtime:

\\\
foo.Icon = _
New Icon( _
[Assembly].GetExecutingAssembly().GetManifestResourceStream( _
"WindowsApplication1.Ball.ico" _
) _
)
///

'WindowsApplication1' is the root namespace of the application, "Ball.ico"
is the icon's filename.
 
* "jcrouse said:
Currently this is the way I have things setup. I have an installer in my
project. I added a folder to the installer package and added all of the
image files to the installer package folder. I the declare the in the code
and then call them.

Dim myImage as New Bitmap(Application.StartupPath & "\Images")
PictureBox.Image = myImage

When I embed the in the executable and then remove them for the installer
package folder, how do I then reference them in my code? Also, should they
be disposed of when the form is closed and the image is no longer being
used. I'm talking about fifty or sixty images here and am concerned with
system resource usage.

If you load them like I load the images in the sample I posted in the
previous message, you can/should dispose the images when you don't need
them any more.
On a side note. I also have my icon files and banner images for the
installer package in the same above mentioned folder. How do I embed them.

I don't know that.
 
Oops, sorry I didn't notice your code. I tried it but don't understand the
[Assembly] parameter. Should I add an assembly to my project and somehow add
the image (jpg) files to the assembly?

Thanks,
John
 
Back
Top