|
-
Apr 10th, 2020, 09:59 PM
#13
Re: Store binary data in UserControl?
Here's another idea, untested. I don't have VB on this box, so bear with me.
Technically, you can include any binary data you want as a 32bpp bitmap. So, using a little creativity...
This is a bit of a hack.
1. Personally, going this route, I don't think I combine all your binary data into 1 bitmap. Use an image control per binary "file"
-- entire image file is the bitmap's data, not just the image pixel info
2. You will need to add some overhead to know the actual size of the embedded image file because your 32bpp bitmap data will be DWord aligned, equal to or larger than the file
-- could be a simple as a 4 byte value as the first "pixel" in the bitmap.
3. At runtime, you'll need to get the pixel data (which is really your file) via APIs like GetDibits.
If interested, play with a test project to get your logic down. That project should dynamically build a valid bitmap that simply embeds a selected file and can display the bitmap (pixel gibberish) to ensure your bitmap is valid. Then of course, create the routines needed to extract the embedded file. Of course you'll have a ctx file when all said and done. As for the bitmap dimensions? If the file size is < 1gb, might as well make it a bitmap 1 x (file size + overhead) divided by 4 and rounded up to DWord
Edited: I think I actually have code a home that does something like this. I wrote it as a test when I was playing with steganography. But I'm at work and won't be at my pc for another 12 hours
Last edited by LaVolpe; Apr 10th, 2020 at 10:07 PM.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|