|
|
Limitation in the parsing of RC files |
IssueOn occasion you may experience problems inserting RC files into your TTK project files. This generates the error message 'Cannot Load File'. ReasonThis is generally due to an incorrect syntax within the RC file. Investigation of the file in Microsoft Visual Studio can show where the offending syntax error is and when found it should be deleted or modified to correct the syntax error. The vast majority of RC files encountered are handled perfectly by Alchemy Catalyst, however there is a known issue regarding Alchemy Catalyst's handling of some #ifdef statements in a small number .rc files. SolutionLimitation of #ifdef statementsIn explanation of why this problem is encountered it is best to demonstrate how the issue can be worked around. Once demonstrated it should be quite easy for the user to avoid the issue. Correct ways of writing menusExample One: Standard Menu Definition SAMPLE_MENU1 MENU BEGIN MENUITEM "&Join Conditions...\tCtrl+J", IDM_JOINCONDITIONS MENUITEM "Data Object <> &Relationship", IDM_OBJNEREL MENUITEM "Edit Database &Name...", IDM_NAMEINDB MENUITEM "O&bject Name...", IDM_OBJNAME END While the above is the normal way to define menus, occasionally developers see fit to use #ifdef statements to further define how a menu behaves. Example Two: Two completely different versions of a menu as follows, depending on a #define #ifdef ADMIN SAMPLE_MENU2 MENU BEGIN MENUITEM "Admin &Join Conditions...\tCtrl+J", IDM_JOINCOND MENUITEM "Admin Data Object <> &Relationship", IDM_OBJNEREL MENUITEM "Admin Edit Database &Name...", IDM_DBNME MENUITEM "Admin O&bject Name...", IDM_DISPLAYNAME END #else SAMPLE_MENU2 MENU BEGIN MENUITEM "&Join Conditions...\tCtrl+J", IDM_JOINCOND MENUITEM "Data Object <> &Relationship", IDM_OBJNEREL MENUITEM "Edit Database &Name...", IDM_DBNME MENUITEM "O&bject Name...", IDM_DISPLAYNAME END #endif Example Three: Different Menu Options controlled by the #ifdef statement SAMPLE_MENU3 MENU BEGIN MENUITEM "Objects", IDM_OBJNEREL #ifdef ADMIN MENUITEM "&Join Conditions One...\tCtrl+J", IDM_JOINCOND #else MENUITEM "&Join Conditions Two...\tCtrl+J", IDM_JOINCOND #endif MENUITEM "Data Object <> &Relationship", IDM_OBJNEREL MENUITEM "Edit Database &Name...", IDM_NAMEINDB MENUITEM "O&bject Name...", IDM_DISPLAYNAME END All of the above ways of defining a menu are handled without problem by Alchemy Catalyst and this covers most cases where developers use #ifdef statements when defining resources. The incorrect ways of writing menus to be handled in Alchemy CatalystThe following is the very unusual case where Alchemy Catalyst's handling of these statements is limited and fails. It is only in the case where the actual declaration of the resource is altered by the #ifdef i.e. the #ifdef occurs between the declaration of the MENU and the BEGIN statement. The following case is not permitted in Alchemy Catalyst. Example Four: Declaration altered by #ifdef - not permitted SAMPLE_MENU4 MENU #ifdef ADMIN BEGIN MENUITEM "&Join Conditions...\tCtrl+J", IDM_JOINCONDITIONS MENUITEM "Data Object <> &Relationship", IDM_OBJNEREL MENUITEM "Edit Database &Name...", IDM_NAMEINDB MENUITEM "O&bject Name...", IDM_DISPLAYNAME END #endif
Related topics
Products or Versions Affected
|