INTELLIGENT WORK FORUMS
FOR COMPUTER PROFESSIONALS

Log In

Come Join Us!

Are you a
Computer / IT professional?
Join Tek-Tips Forums!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!

*Tek-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

Jobs

Imagebox picture clears when you put a frame over it. in Win 7

Imagebox picture clears when you put a frame over it. in Win 7

(OP)
I have an imagebox that I feed with a JPG through a winsock connection.(Using Endamo's routines from my previous posts)
(Using Windows7 pro)
When I temporarily put a frame containing a notice over part of it, when I remove the frame, it erases only the part of the picture previously covered by the frame.

This does not happen when I use loadpicture to put a jpg on the imagebox and does not happen when I move a code window over the first picture with the program halted.

I tried Aero on and off and it doesn't make any difference.

What would be happening here? It seems the picture is not "persistent".

RE: Imagebox picture clears when you put a frame over it. in Win 7

Let's just clarify first. When you say ImageBox (a non-existant control in VB) do you mean PictureBox control or Image control (the mashup of names you've used means it could be either)?

(and just to be pedantic - Edanmo has no routines. It is a type library)

RE: Imagebox picture clears when you put a frame over it. in Win 7

(OP)
By Imagebox I meant Image Control, yes I know I wrongly used the term 'routines'.

Experimenting further I found that if I move a frame over the image only immediately after it has been received, it is OK in that it reappears after the frame has been removed.
But -
I have 16 small (thumbnail size) image boxes receiving different jpgs. but when the next one is received, all previous images remain in their thumbnails and exhibit the fault (they can be partially wiped by a frame over them). It is a bit like the screen effect when you are running out of resources.

A related oddity - I have a larger image box in a frame that I used to magnify the "thumbnail" so it can be inspected in detail by holding the mouse button down on the thumbnail.
(Set BigImage.Picture= Thumbnail(Index).Picture)
Only the last thumbnail received shows on the big picture while nothing shows in the big image when I click on a previous received image.
Is this as though the image remaining on the older thumbnails is not in memory any longer or is it a directX problem?

This does not happen on my old XP machine with only 500mb memory but happens on my WSindows7 64 bit machine with 4gb memory.

RE: Imagebox picture clears when you put a frame over it. in Win 7

Just a 'stab-in-the-dark', but did you try:
Me.Refresh or
Image1.Refresh
when that happens?

Have fun.

---- Andy

A bus station is where a bus stops. A train station is where a train stops. On my desk, I have a work station.

RE: Imagebox picture clears when you put a frame over it. in Win 7

(OP)
The problem seems not to be whether it is Xp or Win 7.
I proved this by feeding between two Win 7 machines and the images on the reception Win7 machine do not exhibit the effect.
It is something I must be doing in relaying the image file to the second machine - maybe missing some vital part of the header or something. I will experiment further.

Is it possible that when setting the Image1.Picture using the IStream method it point to an area of memory that is being reused by the next arriving image, the visible image still remaining only on the desktop and not in memory?

RE: Imagebox picture clears when you put a frame over it. in Win 7

>setting the Image1.Picture using the IStream method

Code, please

RE: Imagebox picture clears when you put a frame over it. in Win 7

(OP)
Problem fixed by indexing everything - see my other related post.

RE: Imagebox picture clears when you put a frame over it. in Win 7

Yep, seen it.

RE: Imagebox picture clears when you put a frame over it. in Win 7

(OP)
Further I found that if I use DeleteObject hBitmap after I have just filled the image control with a picture, it doesn't immediately erase the picture but it causes the picture to exhibit the condition where parts of it can be wiped out by another control and also "sends it to the back" and sets it's picture value to 0.

RE: Imagebox picture clears when you put a frame over it. in Win 7

Yes, that would be right. You need to understand that a handle is not quite the same thing as a simple pointer (sometimes they are the same thing, but mostly not).

And then you need to read the GDI documentation to understand the specifics of a handle to a bitmap (hBitmap)

RE: Imagebox picture clears when you put a frame over it. in Win 7

(OP)
The deleteobject was originally necessary to prevent memory leaks.

RE: Imagebox picture clears when you put a frame over it. in Win 7

Yes, and if I remember correctly, I suggested it. But the goalposts have now moved, and it might help to understand the ramifications of deleting the object

RE: Imagebox picture clears when you put a frame over it. in Win 7

(OP)
I globally indexed the hBitmap so I can deleteobject the last picture received for that image control just before the next picture is processed. This appears to fix the memory leak.

On looking back over the older examples the only suggestion I can see to retrieve a picture from an Image control was to put it in a propertybag which converts it to a byte array.

What I was interested in was to learn how to access the picture and structure in memory and convert the memory bytes directly to a byte array and wondered if there was a 'GDI' or other function that would do this?

RE: Imagebox picture clears when you put a frame over it. in Win 7

>the only suggestion I can see to retrieve a picture from an Image control was to put it in a propertybag

Pretty certain we also covered streams, at least.

But if you really want to get at the bitmap underlying a StdPicture/IPicture, then have a look at the GetDIBits API call. You may also need to refer here: http://msdn.microsoft.com/en-us/library/dd183388%2...

Red Flag This Post

Please let us know here why this post is inappropriate. Reasons such as off-topic, duplicates, flames, illegal, vulgar, or students posting their homework.

Red Flag Submitted

Thank you for helping keep Tek-Tips Forums free from inappropriate posts.
The Tek-Tips staff will check this out and take appropriate action.

Reply To This Thread

Posting in the Tek-Tips forums is a member-only feature.

Click Here to join Tek-Tips and talk with other members!

Resources

Close Box

Join Tek-Tips® Today!

Join your peers on the Internet's largest technical computer professional community.
It's easy to join and it's free.

Here's Why Members Love Tek-Tips Forums:

Register now while it's still free!

Already a member? Close this window and log in.

Join Us             Close