Hi all
I have an image control whose Picture property is a temporary BMP (say Temp1.BMP). I am trying to redisplay the image control with a new Picture property of Temp2.BMP or with a modified Temp1.BMP
Using GDIPlusX, I am creating the BMPs with the BitMap.Save method. Once I have used Temp1.BMP as the picture and later trying to use BitMap.Save again to overwrite Temp1.BMP, the changes are not saved (no error though)
So I used BitMap.Save to create Temp2.BMP, set Temp2.BMP as the picture (which worked fine) and then tried to delete Temp1.BMP. Again this failed (file in use or similar).
I tried Clear Resource Temp1.BMP before Erase Temp1.BMP but that didn't work either.
Any suggestions would be welcome.
Many thanks
Paul Newton
--- StripMime Report -- processed MIME parts --- multipart/alternative text/plain (text body -- kept) text/html ---
Hi Paul,
I have a couple of places that have an BMP loaded in the Image control on a form. The user can change the picture in a popup modal form. The original image is overwritten on disk with code in the modal. When the modal closes, the image is refreshed on the original form.
I'm curious if the GDIPlusX method is leaving the control open with a file handle to the image.
HTH, Tracy
-----Original Message----- From: ProfoxTech [mailto:profoxtech-bounces@leafe.com] On Behalf Of paul.newton.hudl@gmail.com Sent: Sunday, April 03, 2022 2:55 PM To: profoxtech@leafe.com Subject: Problem replacing/deleting temporary picture file
Hi all
I have an image control whose Picture property is a temporary BMP (say Temp1.BMP). I am trying to redisplay the image control with a new Picture property of Temp2.BMP or with a modified Temp1.BMP
Using GDIPlusX, I am creating the BMPs with the BitMap.Save method. Once I have used Temp1.BMP as the picture and later trying to use BitMap.Save again to overwrite Temp1.BMP, the changes are not saved (no error though)
So I used BitMap.Save to create Temp2.BMP, set Temp2.BMP as the picture (which worked fine) and then tried to delete Temp1.BMP. Again this failed (file in use or similar).
I tried Clear Resource Temp1.BMP before Erase Temp1.BMP but that didn't work either.
Any suggestions would be welcome.
Many thanks
Paul Newton
--- StripMime Report -- processed MIME parts --- multipart/alternative text/plain (text body -- kept) text/html ---
[excessive quoting removed by server]
Hi Tracy
Thanks for your reply. I used Sysinternals Process Monitor to see if there was a file handle for the temp image file and there wasn't one. However, I suspect it is something along those lines. In the meantime I am using a different temp file each time and then deleting them in the form Destroy event.
Paul
-----Original Message----- From: ProfoxTech profoxtech-bounces@leafe.com On Behalf Of Tracy Pearson Sent: 05 April 2022 14:44 To: profoxtech@leafe.com Subject: RE: Problem replacing/deleting temporary picture file
Hi Paul,
I have a couple of places that have an BMP loaded in the Image control on a form. The user can change the picture in a popup modal form. The original image is overwritten on disk with code in the modal. When the modal closes, the image is refreshed on the original form.
I'm curious if the GDIPlusX method is leaving the control open with a file handle to the image.
HTH, Tracy
-----Original Message----- From: ProfoxTech [mailto:profoxtech-bounces@leafe.com] On Behalf Of paul.newton.hudl@gmail.com Sent: Sunday, April 03, 2022 2:55 PM To: profoxtech@leafe.com Subject: Problem replacing/deleting temporary picture file
Hi all
I have an image control whose Picture property is a temporary BMP (say Temp1.BMP). I am trying to redisplay the image control with a new Picture property of Temp2.BMP or with a modified Temp1.BMP
Using GDIPlusX, I am creating the BMPs with the BitMap.Save method. Once I have used Temp1.BMP as the picture and later trying to use BitMap.Save again to overwrite Temp1.BMP, the changes are not saved (no error though)
So I used BitMap.Save to create Temp2.BMP, set Temp2.BMP as the picture (which worked fine) and then tried to delete Temp1.BMP. Again this failed (file in use or similar).
I tried Clear Resource Temp1.BMP before Erase Temp1.BMP but that didn't work either.
Any suggestions would be welcome.
Many thanks
Paul Newton
--- StripMime Report -- processed MIME parts --- multipart/alternative text/plain (text body -- kept) text/html ---
[excessive quoting removed by server]