Syntax: ACCELTABLE acceltable-id [mem-option] BEGIN key-value, command[, accelerator-options] . . . END Description The ACCELTABLE statement creates a table of accelerators for an application. An accelerator is a keystroke that gives the user a quick way to choose a command from a menu or carry out some other task. An accelerator table can be loaded when needed from the executable file by using the WinLoadAccelTable function. You can provide any number of ACCELTABLE statements in a resource script file. Each statement must specify a unique table identifier. You can provide any number of accelerator definitions in an accelerator table; however, no two definitions in a table can specify the same key. Each accelerator definition must specify a key value and command. The WinSetAccelTable function used in the application translates the accelerator keystroke into a WM_COMMAND, WM_HELP, or WM_SYSCOMMAND message that has the corresponding command value. The message type depends on the accelerator-option field. acceltable-id Specifies the accelerator-table identifier. This value must be an integer in the range 0 through 65 535, or a simple expression that evaluates to a value in that range. Each accelerator table in a resource script file must have a unique identifier. mem-option Specifies how the system manages the resource when it is in memory. This value must be one of the following: Option Meaning FIXED System keeps the resource at a fixed memory location. MOVEABLE System moves the resource as necessary to compact memory. This is the default option. DISCARDABLE System discards the resource if it is no longer needed. key-value Specifies the character, scan, or virtual-key code of the accelerator key. The meaning depends on the accelerator-options field. The key-value field must be a single character enclosed in double-quotation marks or an integer in the range 0 through 255. If you specify an integer, you must specify the CHAR, SCANCODE, or VIRTUALKEY accelerator option; otherwise, the default option is CHAR. Integers must be in decimal or hexadecimal notation. command Specifies the command value for the corresponding WM_COMMAND, WM_HELP, or WM_SYSCOMMAND message. This value must be an integer in the range 0 through 65 535, or a simple expression that evaluates to an integer in that range. accelerator-options Specifies the accelerator type. This value can be a combination of the following: VIRTUALKEY Specifies that the key-value field is a virtual-key code. SCANCODE Specifies that the key-value field is a keyboard scan code. CHAR Specifies that the key-value field is a character code. SHIFT Specifies that the user must press the Shift key and the key corresponding to the key-value field to generate the accelerator. CONTROL Specifies that the user must press the Ctrl key and the key corresponding to the key-value field to generate the accelerator. ALT Specifies that the user must press the Alt key and the key corresponding to the key-value field to generate the accelerator. LONEKEY Specifies that the user needs to press only the key corresponding to the key-value field to generate the accelerator. SYSCOMMAND Specifies that the accelerator translates to a WM_SYSCOMMAND message. If you do not include this option, the accelerator translates to a WM_COMMAND message. HELP Specifies that the accelerator translates to a WM_HELP message. If you do not include this option, the accelerator translates to a WM_COMMAND message. Note: VIRTUALKEY, SCANCODE, and CHAR are mutually exclusive. SYSCOMMAND and HELP are also mutually exclusive. Comments If two accelerators use the same key with different Shift, Control, or ALT options, you should specify the more restrictive accelerator first in the table. For example, you should place Shift+Enter before Enter. If you include the OS2.H header file, you can use the following constants to specify the accelerator options: ³ ³ AF_ALT ³AF_CHAR ³AF_CONTROL ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÅÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÅÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ AF_HELP ³AF_LONEKEY ³AF_SCANCODE ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÅÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÅÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ AF_SHIFT ³AF_SYSCOMMAND ³AF_VIRTUALKEY ³ ³ To combine these constants, you must use the bitwise OR (|) operator. Example This example creates an accelerator table whose accelerator-table identifier is 1. The table contains two accelerators: Ctrl+S and Ctrl+G. These accelerators generate WM_COMMAND messages with values of 101 and 102, respectively, when the user presses the corresponding keys. ACCELTABLE 1 BEGIN "S", 101, CONTROL "G", 102, CONTROL END ------------------------------------------------------------------------------ BITMAP Syntax: BITMAP bitmap-id [load-option] [mem-option] filename Description The BITMAP statement defines a bit map resource for an application. A bit map resource, typically created using the Icon Editor, is a custom bit map that an application uses in its display or as an item in a menu. The BITMAP statement copies the bit map resource from the file specified in the filename field and adds it to the application's other resources. A bit map resource can be loaded from the executable file when needed by using the GpiLoadBitmap function. You can provide any number of BITMAP statements in a resource script file, but each statement must specify a unique bitmap-id value. bitmap id Specifies the bitmap-resource identifier. This value must be an integer in the range 0 through 65 535, or a simple expression that evaluates to a value in that range. load-option Specifies when the system loads the resource from the executable file into memory. This value must be one of the following: PRELOAD System loads the resource when the application starts. LOADONCALL System loads the resource when the application calls the GpiLoadBitmap function. This is the default option. mem-option Specifies how the system manages the resource when it is in memory. This value must be one of the following: FIXED System keeps the resource at a fixed memory location. MOVEABLE System moves the resource as necessary to compact memory. This is the default option. DISCARDABLE System discards the resource if it is no longer needed. filename Specifies the name of the file containing the icon resource. If the file is not in the current directory, filename must be preceded by a full path. Example This example defines a bit map whose bitmap identifier is 12. The bitmap resource is copied from the file CUSTOM.BMP. BITMAP 12 custom.bmp ------------------------------------------------------------------------------ ICON Syntax: ICON icon-id load-option mem-option filename Description This form of the ICON statement defines an icon resource for an application. An icon resource, typically created by using Icon Editor, is a bit map defining the shape of the icon to be used for a given application. The ICON statement copies the icon resource from the file specified in the filename field and adds it to the application's other resources. An icon resource can be loaded when creating a window by using the WinCreateStdWindow function with the FS_ICON style. You can provide any number of ICON statements in a resource script file, but each statement must specify a unique icon-id value. icon-id Specifies the icon-resource identifier. This value must be an integer in the range 0 through 65 535, or a simple expression that evaluates to a value in that range. A icon-id of 1 has a special meaning; for details, see the "Comment" section. load-option Specifies when the system loads the resource from the executable file into memory. This value must be one of the following: PRELOAD System loads the resource when the application starts. LOADONCALL System loads the resource when the application calls the WinCreateStdWindow function. This is the default option. mem-option Specifies how the system manages the resource when it is in memory. This value must be one or more of the following: FIXED System keeps the resource at a fixed memory location. MOVEABLE System moves the resource as necessary to compact memory. DISCARDABLE System discards the resource if it is no longer needed. The default setting is MOVEABLE and DISCARDABLE. filename Specifies the name of the file containing the icon resource. If the file is not in the current directory, filename must be preceded by a full path. Comments An icon with an icon-id of 1 is the default icon. The RC program writes the icon not only to the resources in your executable file, but also as the .ICON extended attribute. File Manager will display this icon next to the name of the executable file. Example This example defines an icon whose icon identifier is 11. The icon resource is copied from the file custom.ico. ICON 11 custom.ico ------------------------------------------------------------------------------ MENU Syntax: MENU menu-id load-option mem-option BEGIN menuitem-definition . . . END Description The MENU statement defines the contents of a menu resource. A menu resource is a collection of information that defines the appearance and function of an application menu. A menu is a special input tool that lets a user choose commands from a list of command names. A menu resource can be loaded from the executable file when needed by using the WinLoadMenu function. You can provide any number of MENU statements in a resource script file, but each statement must specify a unique menu-id value. You can provide any number of menuitem-definition statements in the menu. These define the submenus and menu items (commands) in the menu. The order of the statements defines the order of the menu items. menu-id Specifies the menu-resource identifier. This value must be an integer in the range 0 through 65 535, or a simple expression that evaluates to a value in that range. load-option Specifies when the system loads the resource from the executable file into memory. This value must be one of the following: PRELOAD System loads the resource when the application starts. LOADONCALL System loads the resource when the application calls the WinLoadMenu function. This is the default option. mem-option Specifies how the system manages the resource when it is in memory. This value must be one or more of the following: FIXED System keeps the resource at a fixed memory location. MOVEABLE System moves the resource as necessary to compact memory. DISCARDABLE System discards the resource if it is no longer needed. The default setting is MOVEABLE and DISCARDABLE. menuitem-definition Specifies a PRESPARAMS, MENUITEM, or SUBMENU statement. You can use one or more PRESPARAMS statements to control the appearance of a menu, such as the font and the foreground and background colors. If used, PRESPARAMS statements must be the first statements following the BEGIN keyword. For details about the PRESPARAMS statement, see PRESPARAMS Statement. MENUITEM and SUBMENU statements define the individual commands or submenus in the given menu. For details about these statements, see MENUITEM Statement and SUBMENU Statement. Example This example creates a menu resource whose menu identifier is 1. The menu contains a menu item named Alpha and a submenu named Beta. The submenu contains two menu items, Item 1 and Item 2. MENU 1 BEGIN MENUITEM "Alpha", 100 SUBMENU "Beta", 101 BEGIN MENUITEM "Item 1", 200 MENUITEM "Item 2", 201, , MIA_CHECKED END END SUBMENU Syntax: SUBMENU text, submenu-id , menu-style BEGIN menuitem-definition . . . END Description The SUBMENU statement creates a submenu for a given menu. A submenu is a vertical list of menu items from which the user can choose a command. You can provide any number of SUBMENU statements in a MENU statement, but each SUBMENU statement must specify a unique submenu-id value. You can provide any number of menuitem-definition statements in the SUBMENU statement. These define the menu items (commands) in the menu. The order of the statements determines the order of the menu items. text Specifies the text of the submenu. This field must contain zero or more characters enclosed in double quotation marks. Character values must be in the range 1 through 255. If a double quotation mark is required in the string, you must include the double quotation mark twice. A tilde ( ~ ) character in the item name indicates that the following character is used as a mnemonic character for the item. When the menu is displayed, the tilde is not shown, but the mnemonic character is underlined. The user can choose the menu item by pressing the key corresponding to the underlined mnemonic character. submenu-id Specifies the submenu identifier. This value must be an integer in the range 0 through 65 535, or a simple expression that evaluates to a value in that range. menu-style Specifies the submenu style. This value can be a combination of MIS_ values. For details on the MIS_ values, see MENUITEM Statement. menuitem-definition Specifies a PRESPARAMS or MENUITEM statement. You can use the PRESPARAMS statement to control the appearance of a submenu, such as the font and the foreground and background colors. If used, the PRESPARAMS statement must immediately follow the BEGIN keyword. For details about the PRESPARAMS statement, see PRESPARAMS Statement. The MENUITEM statement defines an individual command in the given menu. For details, see MENUITEM Statement. Example This example creates a submenu named Elements. Its identifier is 2. The submenu contains three menu items, which are created by using MENUITEM statements. SUBMENU "Elements", 2 BEGIN MENUITEM "Oxygen", 200 MENUITEM "Carbon", 201, , MIA_CHECKED MENUITEM "Hydrogen", 202 END MENUITEM Syntax: MENUITEM text, menu-id, menu-style, menu-attribute Description MENUITEM SEPARATOR The MENUITEM statement creates a menu item for a menu. The statement, permitted only in a MENU or SUBMENU statement, defines the text, identifier, and attributes of a menu item. The system displays the text when it displays the corresponding menu. If the user chooses the menu item, the system generates a WM_COMMAND message that includes the specified menu-item identifier and sends it to the window owning the menu. You can provide any number of MENUITEM statements, but each must have a unique menu-id value. The alternative form of the MENUITEM statement, MENUITEM SEPARATOR, creates a menu separator. A menu separator is a horizontal dividing bar between two menu items in a submenu. The separator is not active - that is, the user cannot choose it, it has no text associated with it, and it has no identifier. text Specifies the text of the menu item. This field must contain zero or more characters enclosed in double quotation marks. Character values must be in the range 1 through 255. If a double quotation mark is required in the string, you must include the double quotation mark twice. The tilde character ( ~ ) and the \t and \a character combinations have special meanings in the string; for details, see the "Comments" section. If the menu-style field is MIS_BITMAP, item-name must be a bitmap identifier instead of a name. The bit map identifier must have been previously defined using a BITMAP statement, must be preceded by the \b character, and must be enclosed in double quotation marks. menu-id Specifies the menu-item identifier. This value must be an integer in the range 0 through 65 535, or a simple expression that evaluates to a value in that range. Each identifier must be unique. menu-style Specifies the menu-item style. This value can be a combination of the following: MIS_BITMAP Specifies that item-name is a bit map identifier. MIS_BREAK Specifies that the menu has multiple columns of items in one pull-down menu or multiple lines of menus in the top-level menu. MIS_BREAKSEPARATOR Specifies that the menu has a vertical line between the columns in a pull-down menu. MIS_BUTTONSEPARATOR Specifies that the user can activate the menu item only by using the mouse. The text is centered in the item, rather than left justified. This option is used for the Help item on the right side of the menu bar. MIS_HELP Specifies that the menu item generates a WM_HELP message. MIS_OWNERDRAW Specifies that the menu item is drawn by the owner window. MIS_SEPARATOR Specifies that the menu item is a menu separator. Although the item-name and menu-id fields are ignored, you must still give values if you specify this style. MIS_STATIC Specifies that the user cannot choose the menu item. MIS_SUBMENU Specifies that the MENUITEM statement is to be treated as a SUBMENU statement. When you specify this option, you must follow the MENUITEM statement with a BEGIN and END clause, as in a SUBMENU statement. You may include a PRESPARAMS statement immediately after the BEGIN keyword. MIS_SYSCOMMAND Specifies that the menu item generates a WM_SYSCOMMAND message. MIS_TEXT Specifies that item-name is a character string. This is the default option. menu-attribute Specifies the menu-item attributes. This value can be a combination of the following: MIA_CHECKED Places a check mark next to the menu-item name. MIA_DISABLED Disables the menu item, preventing the system from generating a message when the user chooses the command. MIA_FRAMED Places a frame (heavy border) around the menu item. MIA_HILITED Places a highlight on the menu-item name when it is displayed, by inverting the name and background. MIA_NODISMISS Causes a submenu or menu item to remain displayed after the user chooses an item. Comments You can use the \t or \a character combination in any item name. The \t character inserts a tab when the name is displayed and is typically used to separate the menu-item name from the name of an accelerator key. The \a character aligns to the right all text that follows it. These characters are intended to be used for menu items in submenus only. The width of the displayed submenu is always adjusted so that there is at least one space (and usually more) between any pieces of text separated by a \t or a \a. (When compiling the menu resource, the compiler stores the \t and \a characters as control characters. For example, the \t is stored as 0x09.) A tilde ( ~ ) character in the item name indicates that the following character is used as a mnemonic character for the item. When the menu is displayed, the tilde is not shown, but the mnemonic character is underlined. The user can choose the menu item by pressing the key corresponding to the underlined mnemonic character. Example This example creates a menu item named Alpha. The item identifier is 101. MENUITEM "Alpha", 101 This example creates a menu item named Beta. The item identifier is 102. The menu item has a text style and a checked attribute. MENUITEM "Beta", 102, MIS_TEXT, MIA_CHECKED This example creates a menu separator between menu items named Gamma and Delta. MENUITEM "Gamma", 103 MENUITEM SEPARATOR MENUITEM "Delta", 104 This example creates a menu item that has a bit map instead of a name. The bitmap identifier, 1, is first defined using a BITMAP statement. The identifier for the menu item is 301. Note that a sign must be placed in front of the bit map identifier in the MENUITEM statement. BITMAP 1 mybitmap.bmp MENUITEM "#1", 301, MIS_BITMAP ------------------------------------------------------------------------------ POINTER Syntax: POINTER pointer-id load-option mem-option filename Description The POINTER statement defines a pointer resource for an application. A pointer resource, typically created by using the OS/2* Icon Editor, is a bit map defining the shape of the mouse pointer on the screen. The POINTER statement copies the pointer resource from the file specified in the filename field and adds it to the application's other resources. A pointer resource can be loaded from the executable file when needed by using the WinLoadPointer function. You can provide any number of POINTER statements in a resource script file, but each statement must specify a unique pointer-id value. pointer-id Specifies the pointer-resource identifier. This value must be an integer in the range 0 through 65 535, or a simple expression that evaluates to a value in that range. load-option Specifies when the system loads the resource from the executable file into memory. This value must be one of the following: PRELOAD System loads the resource when the application starts. LOADONCALL System loads the resource when the application calls the WinLoadPointer function. This is the default option. mem-option Specifies how the system manages the resource when it is in memory. This value must be one or more of the following: FIXED System keeps the resource at a fixed memory location. MOVEABLE System moves the resource as necessary to compact memory. DISCARDABLE System discards the resource if it is no longer needed. The default setting is MOVEABLE and DISCARDABLE. filename Specifies the name of the file containing the pointer resource. If the file is not in the current directory, filename must be preceded by a full path. Example This example defines a pointer whose pointer identifier is 10. The pointer resource is copied from the file custom.cur. POINTER 10 custom.cur ------------------------------------------------------------------------------ RCDATA Syntax: RCDATA resource-id BEGIN data-definition , data-definition ... . . . END Description The RCDATA statement defines a custom-data resource for an application. The custom data can be in whatever format the application requires. You can provide any number of RCDATA statements in a resource script file, but each statement must specify a unique resource-id value. A custom-data resource can be loaded from the executable file when needed by using the DosGetResource or DosGetResource2 functions with the RT_RCDATA resource type. resource-id Specifies the custom-data identifier. This value must be an integer in the range 0 through 65 535, or a simple expression that evaluates to a value in that range. data-definition Specifies the custom data. The data may be simple expressions or strings. Example This example defines custom data that has a resource identifier of 5. RCDATA 5 BEGIN "E. A. Poe", 1849, -32, 3L, 0x8000000l, 3+4+5 END ------------------------------------------------------------------------------ STRINGTABLE Syntax: STRINGTABLE load-option mem-option BEGIN string-id string-definition . . . END Description The STRINGTABLE statement creates one or more string resources for an application. A string resource is a null-terminated character string that has a unique string identifier. A string resource can be loaded from the executable file when needed by using the WinLoadString function. You can provide any number of STRINGTABLE statements in a resource script file. The compiler treats all the strings from the various STRINGTABLE statements as if they belonged to a single statement. This means that no two strings in a resource script file can have the same string identifier. load-option Specifies when the system loads the resource from the executable file into memory. This value must be one of the following: PRELOAD System loads the resource when the application starts. LOADONCALL System loads the resource when the application calls the WinLoadString function. This is the default option. mem-option Specifies how the system manages the resource when it is in memory. This value must be one or more of the following: FIXED System keeps the resource at a fixed memory location. MOVEABLE System moves the resource as necessary to compact memory. DISCARDABLE System discards the resource if it is no longer needed. The default setting is MOVEABLE and DISCARDABLE. string-id Specifies the character-string identifier. This value must be an integer in the range 0 through 65 535, or a simple expression that evaluates to a value in that range. The value can be specified in decimal or hexadecimal notation. Each string identifier in a resource script file must be unique. string-definition Specifies a character string. This field must contain zero or more characters enclosed in double quotation marks. Character values must be in the range 1 through 255. If a double quotation mark is required in the string, you must include the double quotation mark twice. Comments You can continue a string on multiple lines by terminating the line with a backslash (\) or by terminating the line with a double quotation mark (") and then starting the next line with a double quotation mark. Example This example creates two string resources whose string identifiers are 1 and 2. #define IDS_HELLO 1 #define IDS_GOODBYE 2 STRINGTABLE BEGIN IDS_HELLO "Hello" IDS_GOODBYE "Goodbye" END