home *** CD-ROM | disk | FTP | other *** search
/ Hall of Fame / HallofFameCDROM.cdr / window / mewel12.lzh / CHANGES.DOC < prev    next >
Text File  |  1989-06-28  |  36KB  |  1,102 lines

  1.                           CHANGES TO MEWEL 1.2
  2.                           --------------------
  3.  
  4. This document details changes and additions which have been made to the
  5. latest version of MEWEL. These changes have *not* been included in the
  6. regular users manual.
  7.  
  8. One of the goals of enhancing MEWEL is to further increase the compatability
  9. between MEWEL apps and Microsoft Windows apps. Some of these enhancements
  10. have been done expressedly for this purpose.
  11.  
  12. *******************************************************************************
  13.  
  14. ADDITIONAL PARAMETER ADDED TO DIALOGCREATE()
  15. --------------------------------------------
  16. An additional parameter has been added to the end of the argument list for
  17. DialogCreate(). The last argument is the identifier of the dialog box. The
  18. prototype for DialogCreate() now looks like this :
  19.  
  20.  HWND pascal DialogCreate(HWND hParent, int row1,int col1,int row2,int col2,
  21.                           BYTE *title, WORD attr, WORD dlgflags,
  22.                           BOOL (pascal *dlgfunc)(),
  23.                           WORD id);     <=============== new!
  24.  
  25. This change was done so that dialog boxes could be given control ids just
  26. like any other windows.
  27.  
  28.  
  29. *******************************************************************************
  30.  
  31. CreateWindow() ADDED
  32. --------------------
  33. Instead of using the various XXXCreate() functions to create a window of
  34. a specific class (ie, EditCreate(), StaticCreate(), etc), you can now
  35. use a single generic creation function - CreateWindow(). This is pretty
  36. much the same CreateWindow() found in Microsoft Windows.
  37.  
  38.  
  39. HWND pascal CreateWindow(char *szClass, char *szWindow, DWORD dwStyle,
  40.                          WORD x, WORD y, WORD width, WORD height,
  41.                          WORD attr,  /* <- different from MS-WIndows */
  42.                          WORD id,    /* <- different from MS-WIndows */
  43.                          HWND hParent, HMENU hMenu, WORD hInst,
  44.                          DWORD lpParam)
  45.  
  46.   This is a generic function for creating any type of window in MEWEL.
  47.  
  48. Parameters
  49.   szClass is the name of the window class. It can be a user-defined class
  50. or one of the following predefined classes :
  51.     "NORMAL"     "BUTTON"        "EDIT"       "LISTBOX"       "SCROLLBAR"
  52.     "STATIC"     "PUSHBUTTON"    "CHECKBOX"   "RADIOBUTTON"   "TEXT"
  53.     "FRAME"      "BOX"
  54.  
  55.   szWIndow is the title of the window.
  56.  
  57.   dwStyle are the style bits for the window (WIN_HAS_BORDER, etc).
  58.  
  59.   x and y are the coordinates of the upper left corner of the winmdow.
  60.  
  61.   width and height define the extent of the window.
  62.  
  63.   attr is the color attribute of the window.
  64.  
  65.   id is the control id of the window (especially important for controls).
  66.  
  67.   hParent is the handle of the parent window, or NULLHWND if there is no parent.
  68.  
  69.   hMenu is the handle of the associated menubar.
  70.  
  71.   hInst must be 0 for now. This parameter is in their for MS-WINDOWS
  72. compatability.
  73.  
  74.   lpParam is a user-defined value. This value will be passed to the window
  75. procedure when the window is created - the window procedure will receive a
  76. WM_CREATE message with the value of lpParam passed in the lParam parameter.
  77.  
  78. Returns
  79.   The window handle of the created window if successful, NULLHWND if not.
  80.  
  81. *******************************************************************************
  82.  
  83. BETTER SUPPORT FOR USER-DEFINED CLASSES
  84. ---------------------------------------
  85.  
  86. We have increased the support for user defined window classes. We have
  87. implemented the Microsoft Windows function RegisterClass(). To use this
  88. function, you fill in a structure of type WNDCLASS and pass it as the
  89. only argument to RegisterClass(). MEWEL will register your new class and
  90. keep it in a global table of all classes. You can then pass the class name
  91. as an argument to the CreateWindow() function when you want to create a
  92. window of the new class.
  93.  
  94. The WNDCLASS struct is defined in WINDOW.H, but is repeated here:
  95.  
  96. typedef struct wndClass
  97. {
  98.   struct wndClass *next;           /* used internally by MEWEL */
  99.   DWORD dwStyle;                   /* style bits for the class */
  100.   int   (pascal *pfnWndProc)();    /* the window proc for this class */
  101.   int   (pascal *pfnDefWndProc)(); /* used internally by MEWEL */
  102.   int   cbClsExtra;                /* # of extra bytes for the class */
  103.   int   cbWndExtra;                /* # of window extra bytes per window */
  104.   char  *szClassName;              /* the name of the class    */
  105.   char  *szBaseClass;              /* name of base class */
  106.   WORD  idClass;                   /* used internally by MEWEL */
  107. } WNDCLASS;
  108.  
  109. szBaseClass is the name of the class which the new class will be derived
  110. from. For instance, if you want to make a new class of data entry fields
  111. which only accept numeric input, then you would drive a new class from the
  112. "EDIT" base class. Where does this base class come into play when you
  113. subclass? Two times - when you create a window of the new class, the
  114. creation procedure associated with the base class will be called (in the
  115. example above, EditCreate would be called), and when you call DefWinProc(), 
  116. the default window procedure for the base class would be invoked.
  117.  
  118.  
  119. int pascal RegisterClass(WNDCLASS *pWndClass)
  120.   Allows you to create your own window class. A window class has several
  121. important properties associated with it, including the name of the class,
  122. the default window procedure that all windows in this class will have,
  123. style bits, and the number of bytes which will be allocated for the
  124. window extra area for each window in the class.
  125.  
  126. Parameters
  127.   pWndClass is a pointer to a WNDCLASS structure. This structure is defined
  128. is the file WINDOW.H. The following fields should be filled in by the
  129. application program :
  130.  
  131.   DWORD dwStyle;      /* the class style bits */
  132.   int   (pascal *pfnWndProc)();  /* default winproc for the class */
  133.   int   cbWndExtra;   /* # of bytes allocated for the window extra area */
  134.   char  *szClassName; /* the name of the class */
  135.   char  *szBaseClass; /* the name of the base class */
  136.  
  137. All other fields will be automatically filled in by the RegisterClass()
  138. function.
  139.  
  140. Returns
  141.   TRUE if the class was registered, FALSE if not.
  142.  
  143. Example
  144.  
  145.   extern int pascal MyClassProc();
  146.   WNDCLASS wndClass;
  147.  
  148.   wndClass.szClassName = "MyClass";
  149.   wndClass.szCaseClass = "Edit";
  150.   wndClass.cbWndExtra  = 0;
  151.   wndClass.dwStyle     = 0L;
  152.   wndClass.pfnWndProc  = MyClassProc;
  153.  
  154.   if (!RegisterClass(&wndClass))
  155.   {
  156.     ....... /* error */
  157.   }
  158.  
  159.  
  160. ******************************************************************************
  161.  
  162. WINDOW EXTRA BYTES NOW SUPPORTED
  163. --------------------------------
  164.  
  165. Like Microsoft Windows, MEWEL now supports a per-window storage area which
  166. your application programs can use to store per-window data. Each window which
  167. you create has a pointer to an (possibly null) allocated block of memory
  168. which your application program can manipulate. This area is known as the
  169. "window extra bytes" area.
  170.  
  171. How much memory is allocated?
  172. This is determined by the value of the cbWndExtra field in the window's
  173. class structure. You fill this value in when you register a window class with
  174. the RegisterClass() call.
  175.  
  176. All of the predefined window classes have zero (0) in the cbWndExtra field.
  177. This means that if you create any kind of predefined class of window, no window
  178. extra bytes are allocated to that window. You can allocate this area yourself
  179. by using the SetWIndowExtra() function.
  180.  
  181. You can query or set a single byte value, a two byte value (WORD), or a four
  182. byte value (LONG). There are six API functions corresponding to the six
  183. operations you can perform on the extra bytes.
  184.  
  185. For those of you who purchased the MEWEL 1.0 source code, please note that
  186. the window information that used to reside in the window extra bytes has now
  187. been moved to the class extra bytes area.
  188.  
  189.  
  190. BOOL pascal SetWindowExtra(HWND hWnd, int nBytes)
  191.   Allocates memory for a window's extra byte area. The memory block is
  192. initially set to all zeros.
  193.  
  194. Parameters
  195.   hWnd is the window handle of the window to query.
  196.   nBytes is the number of bytes to allocate for the area.
  197.  
  198. Returns
  199.   TRUE if the operation was successful, FALSE if not.
  200.  
  201.  
  202. BYTE *pascal GetWindowExtra(HWND hWnd)
  203.   Retrieves the address of the beginning of the window extra area.
  204.  
  205. Parameters
  206.   hWnd is the window handle of the window to query.
  207.  
  208. Returns
  209.   The address of the window extra byte area.
  210. PLEASE NOTE --- The address returned by GetWindowExtra() is *NOT*
  211. the same address that you get if you looked at the pWinExtra field of the
  212. window structure.
  213.  
  214.  
  215. BYTE pascal GetWindowByte(HWND hWnd, int iByte)
  216.   Retrieves the single byte residing at the 'iByte' position in the window
  217. extra area.
  218.  
  219. Parameters
  220.   hWnd is the window handle of the window to query.
  221.   iByte is the 0-based byte offset from the start of the window extra area.
  222.  
  223. Returns
  224.   The byte at pWinExtra[iByte].
  225.  
  226.  
  227. WORD pascal GetWindowWord(HWND hWnd, int iWord)
  228.   Retrieves the single word residing at the 'iWord' position in the window
  229. extra area.
  230.  
  231. Parameters
  232.   hWnd is the window handle of the window to query.
  233.   iWord is the 0-based word offset from the start of the window extra area.
  234.  
  235. Returns
  236.   The word at pWinExtra[iWord].
  237.  
  238.  
  239. LONG pascal GetWindowLong(HWND hWnd, int iLong)
  240.   Retrieves the single long residing at the 'iLong' position in the window
  241. extra area.
  242.  
  243. Parameters
  244.   hWnd is the window handle of the window to query.
  245.   iLong is the 0-based long offset from the start of the window extra area.
  246.  
  247. Returns
  248.   The long at pWinExtra[iLong].
  249.  
  250.  
  251.  
  252. BYTE pascal SetWindowByte(HWND hWnd, int iByte, BYTE byte)
  253.   Sets the value of the single byte residing at the 'iByte' position in the
  254. window extra area.
  255.  
  256. Parameters
  257.   hWnd is the window handle of the window to query.
  258.   iByte is the 0-based byte offset from the start of the window extra area.
  259.   byte is the single byte value.
  260.  
  261. Returns
  262.   The byte at pWinExtra[iByte].
  263.  
  264. int pascal SetWindowWord(HWND hWnd, int iWord, WORD word)
  265.   Sets the value of the single word residing at the 'iWord' position in the
  266. window extra area.
  267.  
  268. Parameters
  269.   hWnd is the window handle of the window to query.
  270.   iWord is the 0-based word offset from the start of the window extra area.
  271.   word is the single word value.
  272.  
  273. Returns
  274.   The word at pWinExtra[iWord].
  275.  
  276.  
  277. LONG pascal SetWindowLong(HWND hWnd, int iLong, LONG llong)
  278.   Sets the value of the single long residing at the 'iLong' position in the
  279. window extra area.
  280.  
  281. Parameters
  282.   hWnd is the window handle of the window to query.
  283.   iLong is the 0-based long offset from the start of the window extra area.
  284.   long is the single long value.
  285.  
  286. Returns
  287.   The long at pWinExtra[iLong].
  288.  
  289.  
  290. *******************************************************************************
  291.  
  292. WinSetFlag() FUNCTION ADDED
  293. ---------------------------
  294.  
  295. DWORD pascal WinSetFlags(HWND hWnd, DWORD fFlags)
  296.   OR's the window's flags field with the value in the second parameter.
  297.  
  298. Parameters
  299.   hWnd is the handle of the window to query.
  300.   fFlags is the double word value of the flags to OR the current flags with.
  301.  
  302. Returns
  303.   The new value of the flags field if successful, 0 if not.
  304.  
  305.  
  306. *******************************************************************************
  307.  
  308. IMPROVED MESSAGE BOXES
  309. ----------------------
  310.  
  311. You can now define which push button will be the default button in a message
  312. box. Three new flags have been defined which can be ORed with the other
  313. flags. These are :
  314.  
  315. MB_BUTTON1DEF - button 1 is the default button
  316. MB_BUTTON2DEF - button 2 is the default button
  317. MB_BUTTON3DEF - button 3 is the default button
  318.  
  319. For example, 
  320.  
  321.   rc = MessageBox("Do you want to continue?", NULL, NULL, "Error!", 
  322.                                             MB_YESNO | MB_BUTTON2DEF);
  323.  
  324. would make the <NO> button the default button within the message box. If the
  325. user were to press <ENTER> as soon as the message box came up, the IDNO code
  326. would be returned to the application.
  327.  
  328. In addition, the user can now press the first letter of a pushbutton in order
  329. to invoke that button. For example, if you have a YES/NO message box, the
  330. user can press 'y' to choose YES and 'n' to choose NO.
  331.  
  332. *******************************************************************************
  333.  
  334. NEW MENU ATTRIBUTES
  335. -------------------
  336.  
  337. MF_SHADOW - puts a shadow on the bottom right side of the menu. There are
  338. two global variables which you can access in order to change the change the
  339. character and attribute used to produce the shadow. These variables are :
  340.  
  341. BYTE chShadow   = '░';
  342. BYTE attrShadow = 0x07;
  343.  
  344. If you would like a pulldown menu to have a shadow behind it, give the
  345. first item in the popup the attribute of MF_SHADOW. For example :
  346.  
  347.   hPop1 = CreateMenu(hMenu);
  348.   ChangeMenu(hPop1, 0, "~New",        ID_NEW,      MF_APPEND | MF_SHADOW);
  349.   ChangeMenu(hPop1, 0, "~Open...ALT+O",ID_OPEN,    MF_APPEND);
  350.   ........
  351.   ChangeMenu(hPop1, 0, "~Generate",   ID_GENERATE, MF_APPEND);
  352.  
  353.  
  354.  
  355. MF_HELP - used to define a menu item which will be used to invoke help.
  356. If this item is in the menubar (where it should be, according to CUA), then
  357. the item will be displayed right justified at the end of the menu bar. A
  358. vertical separator will be displayed to the left of it. The help item
  359. cannot be move to by cursoring on the menubar; however, you can select it with
  360. the mouse or you can press the corresponding accelerator key to invoke it,
  361. When this item is selected, a WM_HELP message is sent to the winproc of the
  362. menu's parent window. wParam will contain the id of the menu item, so you can
  363. use the id to provide context-sensitive help.
  364.  
  365.  
  366. *******************************************************************************
  367.  
  368. WS_CLIP STYLE ADDED
  369. --------------------
  370.  
  371. In an effort to speed up window output, we have introduced the WS_CLIP
  372. style for windows. When output is written to a window which has the WS_CLIP
  373. style, the window is checked for overlapping windows. Text will not be written
  374. into areas occupied by overlapping windows. Of course, this checking will
  375. slow down output, so you should be prudent about using the WS_CLIP style.
  376. Generally, the WS_CLIP style should be used in the following situations:
  377.  
  378.   - You write to a window which can be obscured by its children.
  379.   - You write to a window which can be overlapped by a sibling.
  380.  
  381. *******************************************************************************
  382. *******************************************************************************
  383. *******************************************************************************
  384.  
  385.                        MEWEL RESOURCE COMPILER
  386.                        -----------------------
  387.  
  388. What is a resource file?
  389. ------------------------
  390. A resource can be considered to be any kind of data. This data is kept in an
  391. external data file called a "resource file", and is read in by your application
  392. when needed. 
  393.  
  394. There are several advtantages to using resource files. First and foremost,
  395. the size of your MEWEL application's EXE file is decreased since data
  396. is kept in another file. Second, the amount of memory that your MEWEL app
  397. uses is decreased since resources can be read in when needed, and then
  398. discarded when their usefulness has ended. Third, you can make changes
  399. to various resource objects (like menus and dialog boxes) without having to
  400. recompile your entire application again.
  401.  
  402. A resource file consistes of one or more object definitions. An object can
  403. be a string table, an accelerator table, a menu, or a dialog box. We will
  404. discuss each object below, along with the definition of its syntax.
  405.  
  406.  
  407. Compiling Resource Files
  408. ------------------------
  409. A resource file normally ends with a ".rc" extension. When you can invoke the
  410. resource compiler as follows:
  411.  
  412.   rc filename        <---- assumes a .rc extension
  413.   rc filename.ext    <---- you can use any extension
  414.  
  415. The generated output will be written to a file of the same name but with a
  416. ".res" extension.
  417.  
  418.  
  419. DEFINITIONS AND SYNTAX
  420. ----------------------
  421.  
  422. Please note that an 'identifier' is a number in this version of the resource
  423. compiler. To give your identifiers more meaning, you can use #define's to
  424. specify a meaningful name. For example, you would use something like this :
  425.  
  426. #define MY_MENU  200
  427. ....
  428. MY_MENU MENU
  429. ...
  430.  
  431.  
  432. StringTables
  433. ------------
  434.  
  435. A stringtable consists of a series of strings and their corresponding numeric
  436. identifiers. In your MEWEL application, you can load a string from the resource
  437. file merely by specifying its identifier.
  438.  
  439. Your resource file can have only one STRINGTABLE defined.
  440.  
  441.  
  442. STRINGTABLE
  443. BEGIN
  444.   identifier1, "string1"
  445.   identifier2, "string2"
  446.   .........
  447. END
  448.  
  449. Example
  450.  
  451. #define "errormsg.h"   /* contains the error message id's */
  452.  
  453. STRINGTABLE
  454. BEGIN
  455.   ERR_OUTOFSPACE,   "You have run out of memory!"
  456.   ERR_FILENOTFOUND, "The file was not found"
  457.   ERR_BADFORMAT,    "An illegal format was encountered"
  458. END
  459.  
  460.  
  461. Accelerators
  462. ------------
  463. Accelerators are discussed in detail in the MEWEL manual. Basically, an
  464. accelerator is an association between a key and a numeric identifier. When
  465. the key is pressed from within your MEWEL application, a WM_COMMAND message
  466. in sent to your window procedure with the corresponding identifier placed in
  467. the wParam argument.
  468.  
  469. identifier ACCELERATORS
  470. BEGIN
  471.   keycode, identifier
  472.   keycode, identifier
  473.   ........
  474. END
  475.  
  476. Example
  477.  
  478. #include "keys.h"
  479. #include "app.h"
  480.  
  481. #define MyAccel  100
  482.  ..
  483. MyAccel ACCELERATORS
  484. BEGIN
  485.   F1,      ID_HELP
  486.   ALT_S,   ID_SHOW
  487.   CTRL_A,  ID_ALL
  488. END
  489.  
  490.  
  491. Menus
  492. -----
  493.  
  494. identifier MENU        ----  MENUITEM SEPARATOR
  495. BEGIN                 /
  496.   menuitems  --------------- MENUITEM "string", identifier options
  497. END                   \                                       |
  498.                        ----  POPUP "string" options           |
  499.                              BEGIN                            |
  500.                                menuitems                   MENUBREAK
  501.                              END                           CHECKED
  502.                                                            INACTIVE
  503.                                                            GRAYED
  504.                                                            HELP
  505.                                                            SHADOW
  506. Example
  507.                                                     
  508. ID_MYMENU MENU
  509. BEGIN
  510.   POPUP "File" SHADOW
  511.   BEGIN
  512.     MENUITEM "Open",    1
  513.     MENUITEM "Save",    2
  514.     MENUITEM "Save As", 3
  515.     MENUITEM SEPARATOR
  516.     MENUITEM "ESC=Cancel", 99 INACTIVE
  517.   END
  518.   MENUITEM "F1=Help", ID_HELP HELP
  519. END
  520.  
  521.  
  522. Dialog Boxes
  523. ------------
  524.  
  525. identifier DIALOG x,y,cx,cy [,color]
  526.   [CAPTION "string"]
  527. BEGIN
  528.   control-class "title", ctrl-id, x,y,cx,cy [,color]
  529.   ........
  530. END
  531.  
  532.  
  533. control-class
  534. -------------
  535. TEXT
  536. FRAME
  537. BOX
  538. EDIT
  539. CHECKBOX
  540. PUSHBUTTON
  541. RADIOBUTTON
  542. LISTBOX
  543. SCROLLBAR
  544.  
  545.  
  546. Example
  547.  
  548. #define ID_NAMETEXT 200
  549. #define ID_NAME     201
  550.  
  551. ID_MYDLG DIALOG 10,3,50,15
  552. CAPTION "My Dialog"
  553. BEGIN
  554.   TEXT "Name:", ID_NAMETEXT, 12,5,5,1
  555.   EDIT "",      ID_NAME,     20,5,25,1
  556. END
  557.  
  558.  
  559. Miscellaneous
  560. -------------
  561. 1) The word BEGIN and END can be replaced by a left curly brace and a right
  562. curly brace respectively. For example,
  563.  
  564.   STRINGTABLE                           STRINGTABLE
  565.   BEGIN                                 {
  566.      ....            is the same as         .....
  567.   END                                   }
  568.  
  569. 2) You can use the #include directive to include a file.
  570. Example
  571.   #include "foo.h"
  572.  
  573. 3) You can use the #define directive to define simple symbols in terms
  574. of other symbols.
  575. Example
  576.   #define IDMENU  1
  577.   #define IDDLG   999
  578.  
  579.  
  580.  
  581.  
  582.                        USING RESOURCES IN MEWEL
  583.                        ------------------------
  584.  
  585. WORD pascal OpenResourceFile(char *szFileName)
  586.   Opens a resource file for use.
  587.  
  588. Parameters
  589.   szFileName is the full name of the resource file to open. You do not
  590. have to specify the ".res" extension.
  591.  
  592. Returns
  593.   The module handle if the resource file was opened, 0 if not.
  594.  
  595.  
  596. void pascal CloseResourceFile(WORD hModule)
  597.   Closes a resource file.
  598.  
  599. Parameters
  600.   hModule is the handle of the resource file to close.
  601.  
  602. Returns
  603.   Nothing.
  604.  
  605.  
  606. int pascal LoadString(WORD hModule, WORD idStr, BYTE *pBuffer, WORD nMax)
  607.   Loads in a string from a resource file.
  608.  
  609. Parameters
  610.   hModule is the handle of the opened resource file.
  611.   idStr is the identifier of the particular string which you want to load.
  612.   pBuffer is a pointer to a user-defined buffer which the string will be
  613. copied into.
  614.   nMax is the size of the user-defined buffer.
  615.  
  616. Returns
  617.   TRUE if successful, FALSE if not.
  618.  
  619.  
  620. HACCEL pascal LoadAccelerators(WORD hModule, WORD idAccel)
  621.   Loads in an accelerator table from a resource file.
  622.  
  623. Parameters
  624.   hModule is the handle of the opened resource file.
  625.   idAccel is the identifier of the particular accelerator table which you
  626. want to load.
  627.  
  628. Returns
  629.   A non-zero handle to the loaded accelerator table if successful, 0 if not.
  630.  
  631.  
  632. HMENU LoadMenu(WORD hModule, WORD idMenu, HWND hParent)
  633.   Loads in a menu from a resource file.
  634.  
  635. Parameters
  636.   hModule is the handle of the opened resource file.
  637.   idMenu is the identifier of the particular menu table which you want to load.
  638.   hParent is the handle of the menu's parent window.
  639.  
  640. Returns
  641.   A non-zero handle to the loaded menu if successful, 0 if not.
  642.  
  643.  
  644.  
  645. HDLG pascal LoadDialog(WORD hModule, WORD idDialog, HWND hParent,
  646.                                                     BOOL (pascal *dlgfunc)())
  647.   Loads in a dialog box from a resource file.
  648.  
  649. Parameters
  650.   hModule is the handle of the opened resource file.
  651.   idDialog is the identifier of the particular dialog box which you want
  652. to load.
  653.   hParent is the handle of the dialog box's parent window.
  654.   dlgfunc is a pointer to the user-defined dialog box procedure.
  655.  
  656. Returns
  657.   A non-zero handle to the loaded dialog box if successful, 0 if not.
  658.  
  659.  
  660. BYTE *pascal DosGetResource(WORD hModule, WORD idType, WORD idName)
  661.   Low level function for loading in a particular resource from a resource file.
  662.  
  663. Parameters
  664.   hModule is the handle of the opened resource file.
  665.   idType is the type of resource to load. It can be on of the following:
  666.     RT_MENU
  667.     RT_DIALOG
  668.     RT_STRING
  669.     RT_ACCELTABLE
  670.   idName is the identifier of the particular object which you want to load.
  671.  
  672. Returns
  673.   A pointer to the loaded resource if successful, NULL if not. The pointer
  674. is to a malloc()'ed area of memory, and can be free()'ed when you no longer
  675. need it.
  676.  
  677.  
  678. Example
  679. -------
  680.  
  681.   char  buf[120];
  682.   HWND  hMain;
  683.   HMENU hMenu;
  684.   HACCEL hAccel;
  685.   WORD  hRes;
  686.  
  687.   ........
  688.  
  689.   if ((hRes = OpenResourceFile("TEST.RES")))
  690.   {
  691.     LoadString(hRes, ID_ERRSTR, buf, sizeof(buf));
  692.  
  693.     if ((hAccel = LoadAccelerators(hRes, 1)))
  694.     {
  695.       AcceleratorSetFocus(hAccel);
  696.       AcceleratorSetWnd(hMain);
  697.     }
  698.  
  699.     if ((hMenu = LoadMenu(hRes, ID_MYMENU, hMain)) != NULLHWND)
  700.       SetMenu(hMain, hMenu);
  701.  
  702.     CloseResourceFile(hRes);
  703.   }
  704.  
  705.  
  706.  
  707.  
  708.                   CHANGES AND ADDITIONS TO MEWEL 1.1
  709.  
  710. Easy way to get Scrollbar handles
  711. ---------------------------------
  712.  
  713. int pascal WinGetScrollbars(HWND hWnd, HWND *hHorizSB, HWND *hVertSB)
  714.  
  715. This function is used to retrieve a window's scrollbar handles.
  716.  
  717. Parameters
  718.   hWnd is the handle of the window which contains the scrollbars. (ie - the
  719. parent window).
  720.   hHorizSB and hVertSB are pointers to handles which will be used to hold
  721. the returned horizontal and vertical scrollbar handles. If a window does
  722. not contain a particular scrollbar, the corresponding handle pointer will
  723. receive a NULL value.
  724.  
  725. Returns
  726.   FALSE if hWnd was not a valid window handle, TRUE otherwise.
  727.  
  728. Example
  729.  
  730.   HWND hMain;
  731.   HWND hVSB, hHSB;
  732.  
  733.   if (WinGetScrollbars(hMain, &hHSB, &hVSB) == TRUE)
  734.   {
  735.     if (hVSB == NULLHWND)
  736.       MessageBox("No vertical scroll bar!", NULL, NULL, "Warning", MB_OK);
  737.     if (hHSB == NULLHWND)
  738.       MessageBox("No horizontal scroll bar!", NULL, NULL, "Warning", MB_OK);
  739.   }
  740.  
  741.  
  742.  
  743. Enhanced WM_CHAR message
  744. ------------------------
  745. WM_CHAR message now has the shift state in the low word of lParam.
  746.  
  747. Accelerator Keys in dialogs
  748. ---------------------------
  749. If a letter of the title or text of a control is highlighted by prefixing
  750. the letter with '~', you can set focus to that control by pressing the
  751. ALT key along with the letter. For instance, if you create a listbox
  752. whose title is "~Files", then when the listbox is displayed, the 'F' will
  753. be highlighted. You can move to that listbox by pressing the ALT+F key.
  754.  
  755.  
  756. WS_GROUP style
  757. --------------
  758. A dialog box control can have the WS_GROUP style. When a control has this
  759. style, it can be moved to by pressing the UP or DOWN arrow keys from within
  760. the dialog box.
  761.  
  762.  
  763. BOOL pascal SetDlgItemStyle(HWND hDlg, int id, DWORD dwStyle)
  764.  
  765. Paramters
  766.   hDlg is the handle to the dialog box.
  767.   id is the identifier of the control within the dialog box.
  768.   dwStyle can be WS_GROUP or any combination of WS_XXXX attributes.
  769.  
  770. Returns
  771.   TRUE if id corresponded to a valid control, FALSE if not.
  772.  
  773.  
  774.  
  775.  
  776. SOUND FUNCTIONS added (file sound.c and sound.h)
  777. ---------------------
  778.  
  779. void SoundBeep(void)
  780.  
  781. Produces a standard error tone (900 Hz).
  782.  
  783. Parameters
  784.   None.
  785.  
  786. Returns
  787.   Nothing.
  788.  
  789.  
  790.  
  791. void SoundClick(void)
  792.  
  793. Produces a pseudo-clicking sound.
  794.  
  795. Parameters
  796.   None.
  797.  
  798. Returns
  799.   Nothing.
  800.  
  801.  
  802.  
  803. void SoundNote(note, octave, duration)
  804.   int      note, octave;
  805.   unsigned duration;
  806.  
  807. Parameters
  808.  
  809. 'Note' can be one of the following values :
  810. RESTNOTE               - Rest (silence for duration)
  811. CNOTE, CsNOTE          - C, C sharp
  812. DNOTE, DsNOTE          - D, D sharp
  813. ENOTE, FNOTE, FsNOTE   - E, F, F sharp
  814. GNOTE, GsNOTE          - G, G sharp
  815. ANOTE, AsNOTE, BNOTE   - A, A sharp, B
  816.  
  817. The "octave" parameter is the octave in which to play the note, and ranges from
  818. MIN_OCTAVE to MAX_OCTAVE, with the higher octaves almost inaudible.  An octave
  819. value of MID_OCTAVE and note value of CNOTE will give middle C.
  820.  
  821. The "duration" is the duration of the note in milliseconds.
  822.  
  823. Returns
  824.   Nothing.
  825.  
  826.  
  827.  
  828. void SoundTone(freq, duration, pause)
  829.   unsigned freq, duration, pause;
  830.  
  831. Parameters
  832.   freq     - cycles per second
  833.   duration - period of square waves in milliseconds
  834.   pause    - period of quiet calibrated in milliseconds
  835.  
  836. Returns
  837.   Nothing.
  838.  
  839.  
  840.  
  841.  
  842. TIMER CHANGES  (file wintimer.c)
  843. --------------
  844.  
  845. Multiple timers were added ala Microsoft Windows. The 'id' parameter in
  846. both the SetTimer() and KillTimer() functions can contain any valid
  847. integer. Likewise, the wParam of WM_TIMER messages will contain a valid id
  848. number. Please see the demo program TIMEDEMO.C for an example of using
  849. both multiple timers and sound.
  850.  
  851. The 'interval' parameter in the SetTimer() function has been changed from
  852. clock ticks to milliseconds. For example, the call
  853.  
  854.   SetTimer(hWnd, 1, 1000, NULL);
  855.  
  856. will set a timer with an id of 1 to go off every second.
  857.  
  858.  
  859.  
  860. MONO MAPPING ADDED (file winmono.c)
  861. ------------------
  862.  
  863. MEWEL now has an internal attribute mapping table which will be used if the
  864. MEWEL programmer specifies. The table maps color attributes into monochrome 
  865. attributes. In order to enable mono mapping, the MEWEl programmer must call 
  866. the function WinUseMonoMap(TRUE). (See below).
  867.  
  868.  
  869. VidGetMode() now returns the video mode number. This will help you deter-
  870. mine if you are running on a mono system (mode 7 is mono). 
  871.  
  872.  
  873. void pascal WinUseMonoMap(int bUseit)
  874.  
  875.   This function tells MEWEL whether or not you want to use the mono map
  876. to translate color attributes to mono attributes. The passed parameter,
  877. buseit, should be non-zero if you want to use the mono mapping, and zero
  878. if you do not want to map. By default, when MEWEL starts up, mono mapping
  879. is disabled.
  880.  
  881. PARAMETERS
  882.   bUseit is TRUE if mono mapping should be used, FALSE if not.
  883.  
  884. RETURNS
  885.   Nothing.
  886.  
  887. EXAMPLE
  888.   /* Enable mono maping if we are running on a mono system */
  889.   if (VidGetMode() == 7)
  890.     WinUseMonoMap(TRUE);
  891.  
  892.  
  893.  
  894. int pascal WinMapAttr(int attr)
  895.  
  896.   Given an attribute in the form of (bg * 16 + fg), returns the mapped mono
  897. attribute.
  898.  
  899. PARAMETERS
  900.   attr is the color attribute to map.
  901.  
  902. RETURNS
  903.   The mapped attribute in the form (bg * 16 + fg).
  904.  
  905.  
  906.  
  907. void pascal WinSetMonoMapColor(int idxColor, int bForeground, int inewColor)
  908.  
  909.   This is used to set a mapping in the monochrome mapping table. idxColor
  910. is the color to map, and can range from 0 to 15. bForeground is TRUE if
  911. idxColor is a foreground color, FALSE if it's a background color. inewColor
  912. is the color which idxColor should be mapped to; inewColor must be either
  913. 0 (for black), 7 (for white), 8 or 15.
  914.  
  915. PARAMETERS
  916.  
  917.   idxColor is the color attribute to map. It must be betwen 0 and 15.
  918.   bForeground  is  TRUE  if  idxColor  is  a foreground attribute, FALSE if
  919. idxColor is a background attribute.
  920.   inewColor is the  monochrome  attribute  to  associated  with  the  color
  921. attribute idxColor.
  922.  
  923. RETURNS
  924.   Nothing.
  925.  
  926. EXAMPLE
  927.   /* Map the green foreground attribute into white on a mono system */
  928.   #define GREEN  2
  929.   #define WHITE  7
  930.   ......
  931.   WinSetMonoMapColor(GREEN, TRUE, WHITE);
  932.  
  933.  
  934.  
  935.  
  936. MULTILINE EDIT CLASSES ADDED
  937. ----------------------------
  938.  
  939. Multiline edit controls, similar to those found is Microsoft Windows, were
  940. added to MEWEL.
  941.  
  942. The following keys invoke edit actions :
  943. LEFT, RIGHT, UP, DOWN     character and line movement
  944. PGUP, PGDN                scroll up/down one window of text
  945. HOME, END                 go to beginning/end of line
  946. CTRL-PGUP, CTRL-PGDN      go to beginning/end of buffer
  947. INS                       toggle insert mode
  948. DEL                       deletes the character under the cursor, or deletes
  949.                           the selected text
  950. BACKSPACE                 deletes the character to the left of the cursor
  951. SHIFT LEFT, SHIFT DOWN,   extends the selected area
  952. SHIFT UP, SHIFT RIGHT,
  953. SHIFT HOME, SHIFT END
  954. F9                        Pastes the contents of the pick buffer in the text
  955. SHIFT F9                  Copies the selected area to the scrap buffer
  956.  
  957.  
  958. Edit Styles
  959. -----------
  960.  
  961. Several styles can be applied to MEWEL edit controls. They are :
  962.  
  963. ES_MULTILINE - the edit control spans multiple lines
  964. ES_AUTOVSCROLL - when the use presses ENTER at the last row of a multiline
  965.                  edit control, the control is scrolled one line up.
  966. ES_AUTOHSCROLL - if the user enters a character at the last column of an
  967.                  edit control, the control scrolls one character to the
  968.                  right 
  969.  
  970. These styles are applied when you call EditCreate. As an example,
  971.  
  972.   hEditWnd = EditCreate(hMain, 10, 30, 16, 50, "Edit Box", 0x31,
  973.                         WIN_HAS_BORDER | WIN_VSCROLL | WIN_HSCROLL |
  974.                         ES_AUTOVSCROLL | ES_AUTOHSCROLL | ES_MULTILINE,
  975.                         ID_EDIT);
  976.  
  977. This creates a multiline edit control which has both horizontal and verti-
  978. cal scrollbars. Both automatic horizontal and vertical scrolling are
  979. enabled.
  980.  
  981.  
  982. New Edit Notification Messages
  983.  
  984. EN_HSCROLL
  985. EN_VSCROLL
  986.   Sent to the edit control's parent window when the user clicks the
  987. horizontal and vertical scrollbars.
  988.  
  989.  
  990. New Edit Messages
  991.  
  992. EM_GETHANDLE
  993.   Retrieves the far address of the an edit control's text buffer.
  994.   lParam is a pointer to a user-supplied far pointer to a holder for the text
  995. buffer.
  996. Example
  997.   char far *szHandle;
  998.   .....
  999.   SendMessage(hEdit, EM_GETHANDLE, 0, (DWORD) (char far **) &szHandle);
  1000.  
  1001. EM_GETLINE
  1002.   This message is sent to an edit control in order to retreive the contents
  1003. of a certain line.
  1004.   wParam is the 1-based index of the line to retrieve.
  1005.   lParam is a far ptr to the buffer to receive the line.
  1006.  
  1007. EM_GETLINECOUNT
  1008.   Returns the number of lines in the edit control.
  1009.  
  1010. EM_GETMODIFY
  1011.   Returns TRUE if the contents of the edit control has been modified, FALSE
  1012. if not.
  1013.  
  1014. EM_GETSEL
  1015.   Retrieves the current text selection points.
  1016.   lParam is a pointer to a user-supplied far pointer to a 2-word memory
  1017. location. The 0-based starting point will be copies to the first word and
  1018. the ending point will be copied to the second word.
  1019. Example
  1020.   WORD markers[2];
  1021.   WORD *pMarkers;
  1022.   .....
  1023.   pMarkers = markers;
  1024.   SendMessage(hEdit, EM_GETSEL, 0, (DWORD) (WORD far **) &szHandle);
  1025.  
  1026. EM_LIMITTEXT
  1027.   This message is sent to an edit control in order to limit the number of
  1028. characters which can be inserted into the control.
  1029.   wParam contains the maximum number of characters which the edit control
  1030. should handle.
  1031.  
  1032. EM_LINEFROMCHAR
  1033.   Given a 0-based position into the edit buffer, returns the 1-based line
  1034. number of the line which falls on that position.
  1035.   wParam is the 0-based position.
  1036.  
  1037. EM_LINEINDEX
  1038.   Given a 1-based line number, returns a 0-based offset from the start of
  1039. the edit buffer where the first character of that line occurs.
  1040.   wParam is the 1-based index of the line to examine.
  1041.  
  1042. EM_LINELENGTH
  1043.   This message is sent to an edit control in order to find out how many
  1044. characters are in a specific line.
  1045.   wParam is the 1-based index of the line to examine.
  1046.  
  1047. EM_LINESCROLL
  1048.   This message is sent to an edit control in order to scroll the contents
  1049. horizontally or vertically.
  1050.   HIWORD(lParam) is the number of lines to scroll.
  1051.   LOWORD(lParam) is the number of columns to scroll.
  1052.  
  1053. EM_REPLACESEL
  1054.   This message is sent to an edit control in order to replace the selected
  1055. text with another string.
  1056.   lParam is a far pointer to a NULL-terminated string. This string will
  1057. replace the contents of the selected area.
  1058.  
  1059.  
  1060. EM_SETMODIFY
  1061.   Sets the "buffer dirty" flag associated with the edit control.
  1062.   wParam should be TRUE if you want to set the "buffer dirty" flag, FALSE if
  1063. you want to clear it.
  1064.  
  1065. EM_SETSEL
  1066.   Sets a selected area in the edit control.
  1067.   LOWORD(lParam) is the 0-based starting point of the selection and 
  1068. HIWORD(lParam) is the 0-based ending point of the selection. If lParam is
  1069. -1L, then the entire text will be selected.
  1070.  
  1071. WM_COPY
  1072.   Copies the selected text into the "scrap buffer".
  1073.  
  1074. WM_CUT
  1075.   Copies the selected text into the "scrap buffer" and then deletes the
  1076. selected text.
  1077.  
  1078. WM_PASTE
  1079.   Inserts the contents of the "scrap buffer" into the edit buffer starting at
  1080. the cursor position.
  1081.  
  1082.  
  1083.  
  1084. Multiple-selection listboxes supported
  1085. --------------------------------------
  1086.  
  1087. The LBS_MULTIPLESEL style can be used for listboxes where more than one
  1088. item can be selected.
  1089.  
  1090. There are two listbox messages which can be used with multiple-selection
  1091. listboxes. The LB_GETSEL message has been enhanced to work with multiple
  1092. selection listboxes. wParam is the index of an entry to test to see if it
  1093. has been selected or not. The LB_SETSEL message will set the selection
  1094. state of a listbox entry. The message details are as follows :
  1095.  
  1096. LB_SETSEL
  1097.   wParam is 0 if the item is to be de-selected, and non-zero if the item is 
  1098. to be selected.
  1099.   LOWORD(lParam) is the index of the listbox entry to select or de-select.
  1100. If LOWORD(lParam) is -1, then all of the entries will be selected or
  1101. de-selected, depending on the value of wParam.
  1102.