Microsoft KB Archive/246307

= BUG: EXE Crashes on Windows NT when Icon has More Than 256 colors =

Article ID: 246307

Article Last Modified on 10/16/2002

-

APPLIES TO


 * Microsoft Visual FoxPro 5.0 Standard Edition, when used with:
 * Microsoft Windows NT 4.0
 * Microsoft Visual FoxPro 5.0a, when used with:
 * Microsoft Windows NT 4.0
 * Microsoft Visual FoxPro 6.0 Professional Edition, when used with:
 * Microsoft Windows NT 4.0

-



This article was previously published under Q246307



SYMPTOMS
When building a Microsoft Visual FoxPro (VFP) executable, it is common practice to attach a custom icon to it. Usually, the custom icon contains two or more resources. This allows the icon to be displayed in various Windows views (small icons, large icons, details, and so forth). If the custom icon contains a 16x16 resource with more than 256 colors, the resulting .exe file does not run on Microsoft Windows NT 4. When the .exe file is started, it immediately exits with a memory error.



RESOLUTION
Build the 16x16 resource in the custom icon with 256 colors or fewer.



STATUS
Microsoft has confirmed that this is a bug in the Microsoft products that are listed at the beginning of this article.



Steps to Reproduce Behavior
 Using Microangelo (manufactured by Impact Software: http://www.impactsoft.com/muangelo/muangelo.html) or some other icon editor, create an icon. Include a 32x32 resource with 256 colors, and a 16x16 resource with more than 256 colors. Open Visual FoxPro 6.0 and create a new project.  Add a new program to the project with one line of code: MESSAGEBOX("HELLO!")  With the project selected, press the CTRL+J key combination to bring up the Project Information window. Use the Attach Icon checkbox to attach the icon created in step 1 to the project. Build the project into an executable.</li> Run the .exe file on a computer running Microsoft Windows NT 4, and note that one of the following error messages appears:

APPLICATION ERROR. The instruction at referenced memory at. The memory could not be "read".

An application error has occurred and an application error log is being generated.

Exception: access violation:, Address:

Fatal error: Exception code: C0000005

</li></ol>

(c) Microsoft Corporation 1999, All Rights Reserved. Contributions by Trevor Hancock, Microsoft Corporation.

<div class="references_section">