Solved

Can I SavePicture with > 256 colors in VB3??

Posted on 1998-05-01
5
245 Views
Last Modified: 2012-05-04
When I try to use the SavePicture Statement when the monitor
is set to more than 256 bit colors, I get an error "out of memory". My complied programs have done the same on several of my users systems.  I can check the users monitor setup and tell them to change it if needed, but I would rather not. Do any one know if this is a basic limitation of VB3? Or is a way to handles this w/o asking the user to reset his monitor setup?
0
Comment
Question by:MinnEE
  • 3
5 Comments
 
LVL 7

Expert Comment

by:kamall
ID: 1436695
MinnEE,
You can save the picture contained in a picture box (Picture1) using the following code:

Sub Command1_Click ()
        SavePicture Picture1.Image, "c:\myfile.bmp"
End Sub

This will save the picture to the file without any problems even in true color mode (16.7 million colors).
I have tested this code in the past on many machines with different color depths w/o problems.

Regards
0
 
LVL 1

Author Comment

by:MinnEE
ID: 1436696
The code you suggested is what I already tried, and I get the error message from VB. I even get it when running the single line of code in the debug window. When I change my monitor back to 256 colors, the problem goes away.  I have a 486 and Win3.1. My complied programs had the same problem on a NT system and another system of unknown version. Since then I have changed my program and quit testing other systems.  Perhaps there is a problem with my VB professional version.
0
 
LVL 1

Author Comment

by:MinnEE
ID: 1436697
On further testing, I do not get the error with 16.7 million colors (24 bit), but only with 65,536 colors (16 bit) in either screen resolutions of 480x640 or 600x800. With my monitor and others I have seen, 16.7 million colors is not available except in the lower resolution of 640x480
0
 
LVL 4

Accepted Solution

by:
zsi earned 100 total points
ID: 1436698
SavePicture does not support more than 256 colors in VB3.  You will basically have to use a third-party VBX like ImageKnife (or similar) or save the bitmap via the API and direct file access.

Save yourself a major headache and go with a VBX.

zsi
0
 
LVL 1

Author Comment

by:MinnEE
ID: 1436699
Zsi,
 Thanks. I suspected this.
MinnEE
 
0

Featured Post

Networking for the Cloud Era

Join Microsoft and Riverbed for a discussion and demonstration of enhancements to SteelConnect:
-One-click orchestration and cloud connectivity in Azure environments
-Tight integration of SD-WAN and WAN optimization capabilities
-Scalability and resiliency equal to a data center

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Have you ever wanted to restrict the users input in a textbox to numbers, and while doing that make sure that they can't 'cheat' by pasting in non-numeric text? Of course you can do that with code you write yourself but it's tedious and error-prone …
Article by: Martin
Here are a few simple, working, games that you can use as-is or as the basis for your own games. Tic-Tac-Toe This is one of the simplest of all games.   The game allows for a choice of who goes first and keeps track of the number of wins for…
As developers, we are not limited to the functions provided by the VBA language. In addition, we can call the functions that are part of the Windows operating system. These functions are part of the Windows API (Application Programming Interface). U…
This lesson covers basic error handling code in Microsoft Excel using VBA. This is the first lesson in a 3-part series that uses code to loop through an Excel spreadsheet in VBA and then fix errors, taking advantage of error handling code. This l…

808 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question