Re: Saving a BITMAP from memory to disk
This looks like something that I can use. However I am using VB.NET and there is no hdc property of a form anymore. Any idea on how I can make this work?
Thanks.
Re: Saving a BITMAP from memory to disk
Are you talking about this line:
tempDC = CreateCompatibleDC(Forms(0).hdc)
If so, you don't need to create a DC for the code in post #6 above. You can simply reference one instead. So you can change
Code:
' change from: tempDC = CreateCompatibleDC(Forms(0).hdc), to
tempDC = GetDC(0&)
' then, instead of: retVal = DeleteDC(tempDC), use this
retVal = ReleaseDC(0&, tempDC)
Since you are using .Net, I'd bet you can find examples in the .Net portion of the forums.
Re: Saving a BITMAP from memory to disk
I searched but found nothing, although I did find questions similar to mine that went unanswered. I don't think I can use this routine anyway. After making that change I get an error from GetObjectAPI "Type 'System.Drawing.Bitmap' cannot be marshaled as an unmanaged structure; no meaningful size or offset can be computed."
Thanks anyway.
Re: Saving a BITMAP from memory to disk
Maybe you should try the .Net forum again. Searching, I found some good examples that allow you to save binary data using .Net's StreamWriter, converting image to jpg using a statement like: "PictureBox1.Image.Save(wfStream, System.Drawing.Imaging.ImageFormat.Jpeg)" (post #30 in that link)
Here are the terms I used when I searched that forum: Bitmap Stream File
Re: Saving a BITMAP from memory to disk
Just in case you did not notice, this thread is 10 years old! Back then there was no .NET...
Re: Saving a BITMAP from memory to disk
Quote:
Originally Posted by
CVMichael
Just in case you did not notice, this thread is 10 years old! Back then there was no .NET...
I didn't even notice :eek:
I only noticed today's post by MarMan and didn't look at the dates of the previous postings.
Re: Saving a BITMAP from memory to disk
Love the idea of saving the bitmap as a string but how do I get the data from .hdc into a string?
Re: Saving a BITMAP from memory to disk
John, you are replying to a 15 year-old thread (started in 2000)
Re: Saving a BITMAP from memory to disk
I know - It's still relevant!