Click here to Skip to main content
15,886,873 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Code working for 20+ years, suddenly produces a blank .bmp file. the code:

SavePicture ZigZagPic.Image, APPDirectory + "45-3-Z.bmp"


an image is there; i can see it. APPPDirectory is valid. picturebox ZigZagPic.scalemode = vbpixels, autoredraw = true

5000+ users are depending on this continuing to work.

What I have tried:

i've searched and found only 1 relevant posting. unfortunately, there was no detail.

i have 2 complete source copies. one for production and one for work in progress. both went awol at the same time. Both copies active but with unrelated activities.

tried re-installing VB6; no change.

tried refreshing before savepicture; no change.

permissions not an issue as blank file is created in the right place.

another test. back in the original code just after the first form (with picturebox) is displayed. different source but with the same properties. Proper .bmp is created. Now, what can disable savepicture?

More test results. I have 5 instances of saving a picturebox image. All the images are created and saved in the same way. 3 of them work. 2 fail. I've checked all their picturebox properties and the only differences are name and size.
Posted
Updated 12-Jul-23 13:04pm
v4
Comments
Member 15627495 8-Jul-23 14:51pm    
'badly read source' for the picture ??
while you are copying it ?
Graeme_Grant 8-Jul-23 22:00pm    
Why VB6 is the real question!
Member 16004169 12-Jul-23 19:08pm    
I made a decision long ago to avoid vb.net due to its vulnerability to hacking. Now, at 81, it's a little late to change horses.
Graeme_Grant 12-Jul-23 20:48pm    
Never too late. The Dot Net (Core) framework now has support for AOT (Ahead of time) compilation. More work is being done. Staying with VB6 is limiting your options and support.
Member 16004169 12-Jul-23 19:05pm    
no copying going on.

1 solution

The first thing to note is that you definitely shouldn't be saving your images in the app directory: in production machines that is under "Program Files" (or "Program Files (x86)") and those folders are write protected under modern OSes to reduce the spread of viruses and other malware. This isn't likely to be your problem - but it may be related if there was a "blank image" file in there to start with your app will be unable to overwrite it and will error (which with ancient VB apps is likely to be swallowed by on Error code).

If it is happening in prod and dev, then reinstalling VB6 will not help - the production version is presumably precompiled and unchanged. I'd start looking at environmental factors such as OSes and if necessary rewrite the app to use a more modern language if that many users really need it.

Other than that, there really isn't much we can do to help from this distance!
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900