If this is your first visit, be sure to
check out the FAQ by clicking the
link above. You may have to register
before you can post: click the register link above to proceed. To start viewing messages,
select the forum that you want to visit from the selection below.

Re: How to save a stdPicture that is an UDT field

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?

Re: How to save a stdPicture that is an UDT field

Originally Posted by DataMiser

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) ?

Re: How to save a stdPicture that is an UDT field

Hello folks

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

Re: How to save a stdPicture that is an UDT field

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 03: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?

* The Perfect Platform for Game Developers: Android
Developing rich, high performance Android games from the ground up is a daunting task. Intel has provided Android developers with a number of tools that can be leveraged by Android game developers.

* The Best Reasons to Target Windows 8
Learn some of the best reasons why you should seriously consider bringing your Android mobile development expertise to bear on the Windows 8 platform.