PRB: Wrong Resources Loaded by Resource Editor or AppStudio

Last reviewed: July 24, 1997
Article ID: Q135912
The information in this article applies to:
  • The Resource Editor (AppStudio) included with: - Microsoft Visual C++ for Windows, versions 1.5, 1.51, 1.52 - Microsoft Visual C++, 32-bit Edition, versions 2.0, 2.1, 2.2, 4.0,

         4.1, 5.0
    

SYMPTOMS

Intermittently, The Resource Editor opens the resources, but the latest modifications are not visible in the editor. This may occur with a project that uses a version control system that doesn't update the timestamp on a file when the file is checked out. It is not a bug in the Resource Editor.

CAUSE

The Resource Editor generates and uses a .APS file. This file contains a binary format of the resources. The Resource Editor loads the resources from this file to reduce the time required to load them. The article mentioned in the "References" section of this article gives more information about this file.

The Resource Editor uses dependency checking to determine if the this file has to be regenerated. In the following scenario, the .APS file is not regenerated. None of the following steps occur simultaneously.

  1. Person X checks out the resource file from the source control system.

  2. Person X modifies and saves the changes to a local copy of the resources. The time on the resource file is now C.

  3. Person Y retrieves a copy of the resource file from the source control system.

  4. Person Y opens and closes the local copy of the resources for the first time. A local version of the .APS file is generated on Y's machine at this point in time. The time on .APS file is now C + delta.

  5. Person X checks in the modified resource file.

  6. Person Y checks out the resources from the source control system and opens the resources.

Person Y will see the resources without the modifications that were made by Person X. The .APS file on Y's machine has a later timestamp (time C + delta) than the resource file (time C), thus the .APS file is not regenerated, and the old version of the resources is loaded.

RESOLUTION

Ensure that the resources are loaded from the resource file instead of from the .APS file whenever the resource file has been updated. One approach is to use a source control system that updates the timestamp of a file upon checkout. The source control system may have a timestamp update option that can be set. If this approach is not possible, delete the .APS file after checking out the resources from source code control software. In either case, the Resource Editor will then open the resources from the resource files and regenerate the .APS file.

STATUS

This behavior is by design.

MORE INFORMATION

To delete the .APS file after checking out the resource, a menu item can be added to the Tools menu. The following sections give one way to implement the menu item.

Steps to Implement Menu Item

To implement a menu item to delete the .APS file, follow these steps:

  1. Create the batch file DELAPS.BAT containing the following command:

    del %1

  2. Add the item to the tools menu via the method described below.

Steps to Add New Menu Item to Tools Menu in Visual C++ 2.x

  1. On the Tools menu, click Customize to bring up the Customize Property Sheet.

  2. Click the Tools Tab.

  3. Click the Add button to add a tool.

  4. Type:

          <path>\DELAPS.Bat
    

    where <path> is the location of the batch file.

  5. On the Tools tab of the Customize Property Sheet, fill in the following information for the new tool:

    Menu Text: Delete .APS files Arguments: $PROJDIR*.APS

  6. Select the 'Close Window on Exit' check box.

Steps to Add New Menu Item to Tools Menu in Visual C++ 1.5x

  1. On the Options menu, click Tools to bring up the Tools dialog box.

  2. Click the Add button to add a tool.

  3. From the Add Tool dialog box, select the DELAPS.BAT file.

  4. Enter the following information in the Tools dialog box:

    Menu Text: Delete .APS file Arguments: $PROJDIR$PROJ.APS

REFERENCES

For more information, please see the following article in the Microsoft Knowledge Base:

   ARTICLE-ID: Q132340
   TITLE     : Common File Extensions Used by Visual C++
 

	
	


Keywords : AppStudioIss kbtshoot
Version : 1.5 1.51 1.52 2.0 2.1 2.2 4.0 4.
Platform : NT WINDOWS
Issue type : kbprb


THE INFORMATION PROVIDED IN THE MICROSOFT KNOWLEDGE BASE IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND. MICROSOFT DISCLAIMS ALL WARRANTIES, EITHER EXPRESS OR IMPLIED, INCLUDING THE WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. IN NO EVENT SHALL MICROSOFT CORPORATION OR ITS SUPPLIERS BE LIABLE FOR ANY DAMAGES WHATSOEVER INCLUDING DIRECT, INDIRECT, INCIDENTAL, CONSEQUENTIAL, LOSS OF BUSINESS PROFITS OR SPECIAL DAMAGES, EVEN IF MICROSOFT CORPORATION OR ITS SUPPLIERS HAVE BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. SOME STATES DO NOT ALLOW THE EXCLUSION OR LIMITATION OF LIABILITY FOR CONSEQUENTIAL OR INCIDENTAL DAMAGES SO THE FOREGOING LIMITATION MAY NOT APPLY.

Last reviewed: July 24, 1997
© 1998 Microsoft Corporation. All rights reserved. Terms of Use.