Saving pictures outside of the program

Is there a way i can save an array of pictures outside the program?
I have thought about using a resource file or picclip, but i am not sure how to save these files outside of my exe.
Any Ideas how i could?
Digb
digbAsked:
Who is Participating?
 
lppjohnsConnect With a Mentor Commented:
This is fairly unwieldy but it may fit the bill.
You are going to create your own file routine.
Start a binary file and save some framing bytes out to it, these could be any series of four byte values you like Lets say X'FF00AABB
Save your picture byte by byte until completion and then save trailing frame bytes, I use reverse order X'BBAA00FF.
Continue saving all your pictures in the array byte by byte, separated by leading and trailing frame bytes.  This will save an unlimited number of pictures in one file.
When reading back off of the drive, simply search for trailing frame bytes and use them to break the incoming pictures into their respective array slots.  For dynamic sizing you can continually redim preserve the array to allow for a new slot each time a new lead frame
byte is detected.  In this manner you can use any filename you choose and save any size "animation" that you choose.
Let me know what you think.
0
 
watyCommented:
Use the savepicture :)

.

Could you explain more...
0
 
digbAuthor Commented:
Ok!
I have a picturebox where a user draws into.
as soon as the user stops (mouse_up), the picture is saved into an array.  There is a command button to add new pictures, but each new picture is saved into an array.
I use the array to create animations by having a different picturebox slowly change pictures by increasing the number value of the array.
But as soon as the user quits the program, the array is resetted and the array is lost.  I want to save the array and all the pictures inside it, into one file (not using save picture since it would create lots of pictures).  I know bitmaps can be accessed from a resource file (.res) but i'm unsure of how to save them to it.  I also know many images can go into a picclip but am unsure how it's possible to save that file, without having it being saved to the form.  (ie instead of saving text to a textbox, i'd rather it became a .txt)
0
Cloud Class® Course: Microsoft Windows 7 Basic

This introductory course to Windows 7 environment will teach you about working with the Windows operating system. You will learn about basic functions including start menu; the desktop; managing files, folders, and libraries.

 
khaledcCommented:
You have to create a resource file. In VB5 there is no direct way of doing it. However, you can create a resource file using VC++ version 5 or higher.
A resource file can contain all the pictures and bitmaps needed to your project and it will significantly drop the size of your exe file.
Give me a yell if you need more help.
0
 
digbAuthor Commented:
Oh, really? Hmm, I don't think I can afford to change to VC++ this late in the game, my deadline is quickly approaching...
Is there a way I can use picclip then?
TIA
0
 
khaledcCommented:
You only use VC++ to create the resource file.
0
 
digbAuthor Commented:
I need the user to be able to save the resource file not the programmer.
I want the user to be able to save his work.
0
 
khaledcCommented:
I am sorry I can not help you but I suggest that you save different bitmaps and save a map file to these bitmaps, map file could be an ascii file that specify where are your bitmaps.
Regards
0
 
digbAuthor Commented:
thanks neway!

0
 
trilloCommented:
I suggeest the following:
First, you have to know how many pictures would you like to save into this single file. Lets say, for example 10.
Let's say your Picture box is 50 x 50 pixels.
Then you could dynamically create PictureBox that is 10 times the width of the original (500 x 50 pixels), then you use the BitBlt API function to paste each one of the bitmaps on the HUGE bitmap, and finally you use the SavePicture method to save the 10 bitmaps on a single file.
0
 
watyCommented:
The res files are embeded into the exe file at compilation.

You could also save the bitmaps in a Database.
0
 
lppjohnsCommented:
Glad you liked that solution.

0
 
digbAuthor Commented:
i'll like it better if someone tells me how to use a ole
chart to save pics...
:)
0
 
lppjohnsCommented:
If everything were an OLE answer we'd fast run out of a need for the ingenious, original programmer now wouldn't we?
:)
0
 
digbAuthor Commented:
well yes...
but that still leaves me with an array of pics i cannot save...
;)
0
 
lppjohnsCommented:
Using that routine, you have saved an array of pictures, if you wanted to make it a dll and instantiate it from within other programs you could do that as well.  It just isn't a nice little pre-packaged routine for you yet, you are going to make it the nice pre-packaged routine for others later.
0
 
digbAuthor Commented:
any chance anyone has a sample program illustrating this?
0
 
lppjohnsCommented:
Take that code that I posted here and place it in it's own Activex dll project, name it PicSaver or whatever you like.
Make a public function named SavePic or whatever and allow an array of pictures to
be passed in to it.
Have an inverse Sub named LoadPic and have it's return type be an array of pictures.

Compile this project, this will make it into a dll.

Whenever you want to use it's functionality, add it to a project's project references and then use early binding and set a new object of type PicSaver to instantiate it, you can then use its Savepic or LoadPic methods to do your storage and retrieval.  
0
 
digbAuthor Commented:
Sounds Good... cept
for saving it byte by byte,
where does the trail bytes and lead bytes get saved to?

0
 
lppjohnsCommented:
You save the lead and trail bytes out to file as well, you convert their hex values to byte values (x'FF = 255, x'00 = 0, etc) and then convert them to hex for the comparison when you read them back in.
0
 
digbAuthor Commented:
That sounds extremely complicated...

0
 
lppjohnsCommented:
It sounds rough, but once you get the concept and you work on it a little bit, it's not a bad deal at all. When you get done with this you will understand the bits and bytes of what you are doing, if you don't want to think about it in hex terms, just save byte values out to disk that you will use later, instead of thinking about it as x'FF00AA55 or whatever, just save out four bytes - 255, 0, 170, 85.  Then when you read in the bytes off of the disk check the value of each byte, (Somewhere between 0 and 255). Write a routine to detect that byte value sequence after each byte is read in.
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.