There are a few options. One way involves using a Byte array to hold the image data within the UDT. Converting the array into a stdPicture object when loading the previously saved file can be accomplished a few ways as well. Or, it is also possible to copy the data directly into a memory Bitmap. The methods you choose should depend on your level of skill.
Please remember to rate the posts and threads that you find useful.
How can something be both new and improved at the same time?
Not sure I understand what the question is. In the title it asks how to save the data but the code just posted is reading the data from file meaning it is already saved.
Not sure I understand what the question is. In the title it asks how to save the data but the code just posted is reading the data from file meaning it is already saved. What is it that you are actually trying to do?
I have a form within a PictureBox object where the user clicks on it and will appear a CommonDialog to choose what image will be loaded into the control. The PictureBox needs to show the image only, because the data are saved into a stdPicture class, that is a field of an UDT.
Once the image is chosen, I need that it is saved within the UDT into a file from which I'll get data next time my application will start. I tried to use the PUT statement to save the UDT into the file, but VB doesn't let me to do that. So I asked here what I should have to do.
WizBang suggested me to manage the picture as an array of bytes, and not like an object (or this is what I understood). The code I posted is what I've to do to load data from the original picture file ready to be saved into my file. A similar process is done when I attempt to get data from my file using the GET statement.
The question is: now that I have the picture loaded into the array, how do I set it to my PictureBox (or to a stdPicture object, that's the same) ?
Meanwhile I was waiting anyone who replies, I did a research and I discovered this interesting link vb6-MP3-WMA-Image-Extraction. I took the part I need and it seems to work well for my own purposes. If anyone has other suggestions to give, I'll be glad to listen to them
Glad to see you found something that works for you. Here is another of essentially the same method, for your comparison. I haven't looked it over, but in the past I've seen such examples which have memory leaks. Hopefully the function you end up using will be complete. http://www.tek-tips.com/viewthread.cfm?qid=1541026
Last edited by WizBang; March 6th, 2013 at 02:19 PM.
Please remember to rate the posts and threads that you find useful.
How can something be both new and improved at the same time?
Bookmarks