Annotation of q_a/samples/menus/readme.txt, revision 1.1.1.1

1.1       root        1:  Sample: Migrating PM Menus to Win32
                      2: 
                      3: Summary:
                      4: 
                      5: MENUS is a migration sample which demonstrates taking a PM
                      6: application code demonstrating menu functionality, and
                      7: converting it to Win32 code.  The sample is not intended to
                      8: demonstrate the best Win32 code possible to show menu
                      9: functionality, but instead tries to emulate the original PM
                     10: applications as closely as possible using as close to the
                     11: same API functions as possible.
                     12: 
                     13: Two tools were used in converting this application:
                     14: RESCONV.EXE, a tool which converts PM resource files to
                     15: Win32 format; and IMAGCONV.EXE, a tool which converts PM
                     16: image files to Win32 format.
                     17: 
                     18: More Information:
                     19: 
                     20: The Sample:
                     21: 
                     22: The original PM sample shows several functions available.
                     23: MENUS.C emulates that functionality as closely as possible.
                     24: Under the Cascade Sample menu, there is an item which will
                     25: allow you to switch to another menu, an item called Cascade
                     26: which demonstrates cascading menus, and another item called
                     27: Disable Cascade which will enable/disable the Cascade item
                     28: and will draw a check mark beside itself while the cascaded
                     29: item is disabled.
                     30: 
                     31: The second item on the Action Bar, "BITMAPS", is itself a
                     32: bitmap.  When selected it opens to six other bitmaps.  The
                     33: third item is a message which tells you that if you press
                     34: and release the second mouse button in the client space, a
                     35: Popup will appear at the location of the cursor.
                     36: 
                     37: If you choose to switch menus by choosing Switch Menus from
                     38: the Cascade Sample menu (or pressing the accelerator key F2)
                     39: you will get a completely new menu with the option "Menu
                     40: Item".  This option opens up to allow you to switch back, or
                     41: to add an item to the Action Bar.  When choosing "Add Item"
                     42: a new functioning menu item is added to the Action Bar with
                     43: the text "1000", and it has an active sub option "6000".
                     44: Select "Add Item" again and another item will appear on the
                     45: Action Bar "1001", with an option "6001".  This pattern
                     46: continues, wrapping the Action Bar around to the window as
                     47: appropriate.
                     48: 
                     49: Using the Tools:
                     50: 
                     51: Using IMAGCONV.EXE is fairly straight forward.  However,
                     52: there are some things to know about Windows resource files
                     53: and the RESCONV.EXE utility before using it.  In PM you can
                     54: define bitmaps as menu items in the .RC file.  In Windows
                     55: this is unsupported.  As a result, the string MIS_BITMAP
                     56: will be flagged.  You will have to remove any reference to
                     57: bitmaps from your menu in the .RC file.  The code in MENUS.C
                     58: demonstrates how to construct such a menu item instead.
                     59: Also, as a result of being able to define bitmaps in a PM
                     60: menu, often times the bitmap might be declared using a
                     61: number to identify it i.e. "BITMAP 9 My.BMP".  The
                     62: RESCONV.EXE utility will change this line to "9 BITMAP
                     63: My.BMP".  You may choose to use a string value in the place
                     64: of the number value i.e. "nine BITMAP My.BMP".
                     65: 
                     66: Another characteristic of RESCONV.EXE is it will take the
                     67: menu declaration of the PM code "MENU ID_RESOURCE" and
                     68: change it to put the symbolic constant in front i.e.
                     69: "ID_RESOURCE MENU".  Windows often uses a string value in
                     70: this place.  You can opt to change the symbolic constant to
                     71: a string i.e. "ID_Resource", or you can type cast the value
                     72: in the Window Class structure i.e. "wc.lpszMenuName =
                     73: (LPTSTR)ID_RESOURCE" (see MENUS.C in defining the wc
                     74: variable for the RegisterClass call).
                     75: 
                     76: In PM MIS_HELP tells PM that a special WM_HELP message will
                     77: be sent if the Help menu item is selected.  In Windows this
                     78: is not supported, therefore you will have to modify your
                     79: code to handle the Help under the WM_COMMAND message.  You
                     80: will also have to modify your .RC file as the RESCONV.EXE
                     81: will flag MIS_HELP and will not write the line its on to the
                     82: target resource file.
                     83: 
                     84: For Accelerator tables, RESCONV.EXE will also change a line
                     85: "ACCELTABLE ID_RESOURCE" to be "ID_RESOURCE ACCELERATORS".
                     86: Again you have the option to change the symbolic constant to
                     87: a string, or to cast it as a LPTSTR in your source code.
                     88: Another thing to know about Accelerators is how they are
                     89: handled in Windows: although in PM their use is almost
                     90: transparent in your source code, in Windows they must be
                     91: loaded and translated around the message loop.  To see an
                     92: example of how this is done, look at the message loop in
                     93: MENUS.C, or search the text for LoadAccelerators and
                     94: TranslateAccelerators.
                     95: 
                     96: Although RESCONV.EXE made other changes to the resource
                     97: file, for the most part they should be transparent to your
                     98: code.
                     99: 
                    100: 
                    101: 

unix.superglobalmegacorp.com

This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.