home *** CD-ROM | disk | FTP | other *** search
/ Liren Large Software Subsidy 6 / 06.iso / a / a560 / 1.ddi / ORDENTRY.TX$ / ORDENTRY.bin
Encoding:
Text File  |  1993-01-03  |  5.6 KB  |  159 lines

  1.  
  2. Windows API Utilities
  3.  
  4. ========================================================================
  5.  
  6. A number of Windows API are used in ORDENTRY.MDB, one of the Microsoft 
  7. Access sample applications.  While the use of the Windows API is not 
  8. necessary to create powerful and robust applications with Microsoft 
  9. Access, it can be useful in certain situations.
  10.  
  11. Each of the Windows API calls used in ORDENTRY.MDB is briefly documented 
  12. below.  For examples, see the module "Windows API Utilities" in 
  13. ORDENTRY.MDB
  14.  
  15. ========================================================================
  16.  
  17.  
  18. CheckMenuItem, EnableMenuItem
  19.  
  20. CheckMenuItem can be used to place or remove a check mark next to a given 
  21. menu item.  Similarly, EnableMenuItem can be used to enable or disable a 
  22. menu item.  These Windows functions can be called directly, but it might 
  23. prove easier to call wu_SetMenuChecked and wu_SetMenuEnabled.
  24.  
  25. Note that these functions cannot be called for a form during the form's
  26. OnOpen or OnMenu events, since the menu may not be completely initialized
  27. during these events.
  28.  
  29.  
  30. DrawMenuBar
  31.  
  32. After modifying a menu (such as wu_SetMenuChecked and wu_SetMenuEnabled 
  33. do), it is necessary to redraw the menu using DrawMenuBar.  See either 
  34. wu_SetMenuChecked or wu_SetMenuEnabled for an example.
  35.  
  36.  
  37. GetActiveWindow
  38.  
  39. GetActiveWindow is used in the wu_GetCurrentDoc function to determine 
  40. the window handle for the "active" or "current" Microsoft Access 
  41. document.  This allows wu_GetCurrentDoc to retrieve a handle to a table 
  42. or query datasheet, or some other non-form window.  This handle, then, 
  43. can be passed to other functions such as wu_CenterDoc.
  44.  
  45.  
  46. GetClassName
  47.  
  48. Without GetClassName, wu_CenterDoc would be slightly less flexible.  The 
  49. wu_CenterDoc function was written to be as generic as possible.  To that 
  50. end, the function will work with non-form windows, such as table and 
  51. query datasheets, as well as forms.  Still, forms present some special 
  52. cases for centering, specifically in the case of pop-up forms.  The 
  53. GetClassName function is used to determine what type of object the 
  54. wu_CenterDoc function is dealing with, in order to special case forms, 
  55. both pop-up and non-pop-up.
  56.  
  57.  
  58. GetClientRect, GetWindowRect
  59.  
  60. GetClientRect and GetWindowRect are used in wu_CenterDoc to determine 
  61. the size of the MDI Client window and the Windows desktop, respectively.  
  62. With this information stored as a rectangle, centering a form over one 
  63. of these parent windows becomes a straightforward task.
  64.  
  65.  
  66. GetDC
  67.  
  68. With so many different video devices available today, it is often 
  69. necessary to query Windows for certain device dependent information, 
  70. such as the number of pixels per inch.  This is especially important 
  71. when sizing a window to "3 inches by 2 inches."  The custom tool palette 
  72. used in ORDENTRY.MDB uses GetDC in this manner.
  73.  
  74.  
  75. GetDesktopWindow
  76.  
  77. GetDesktopWindow is used by wu_GetScreenSize.  The handle returned by 
  78. this function is needed to determine the size of the screen in pixels.
  79.  
  80.  
  81. GetDeviceCaps
  82.  
  83. This function allows wu_ConvertTwipsToPixels to accurately convert a 
  84. measurement stored in twips (like all Microsoft Access size and position 
  85. properties) to inches.  GetDeviceCaps can also be used to retrieve the 
  86. ratio of pixels to inches.
  87.  
  88.  
  89. GetFocus
  90.  
  91. GetFocus plays a minor role in wu_GetCurrentDoc.  It simply retrieves a 
  92. handle to the current Windows window, whatever that may be.
  93.  
  94.  
  95. GetMenu, GetSubMenu
  96.  
  97. Most of the menu functions (such as graying a menu item, or placing a 
  98. check mark next to a menu item) require a handle to the menu or submenu 
  99. to modify.  GetMenu and GetSubMenu are frequently used in the menu 
  100. functions wu_FMenuChecked, wu_FMenuEnabled, wu_SetMenuChecked, and 
  101. wu_SetMenuEnabled.
  102.  
  103.  
  104. GetMenuState
  105.  
  106. This menu utility function returns state information about a particular 
  107. menu item.  You will find it used in both wu_FMenuChecked and 
  108. wu_FMenuEnabled.
  109.  
  110.  
  111. GetParent
  112.  
  113. Calls to GetParent are made in wu_CenterDoc, to determine what to 
  114. reference when centering the object.  In the case of normal forms, 
  115. GetParent returns a handle to the Microsoft Access MDI Client window, 
  116. which is essentially the entire gray area behind the MDI windows.  For 
  117. pop-up windows, GetParent returns a handle to the Windows desktop.
  118.  
  119.  
  120. GetWindow
  121.  
  122. The GetWindow function can be used by an application to query Windows 
  123. for parent and/or sibling relationships for any given window.  In 
  124. ORDENTRY.MDB, GetWindow is used to find window handles for Microsoft 
  125. Access, and the Microsoft Access toolbar.
  126.  
  127.  
  128. IsZoomed
  129.  
  130. IsZoomed simply returns whether or not a given window is maximized.  
  131. This function is used in wu_SetAccessSize.  If wu_SetAccessSize 
  132. determines that Microsoft Access is maximized, it first restores the 
  133. window (using ShowWindow), and then calls MoveWindow to set the 
  134. requested size and position.
  135.  
  136.  
  137. MoveWindow
  138.  
  139. MoveWindow is used in wu_CenterDoc to center the document once the 
  140. centered size and position have been calculated.
  141.  
  142.  
  143. SetFocus
  144.  
  145. With a custom tool palette like the one in ORDENTRY.MDB, it is often 
  146. necessary to switch back to Microsoft Access and the currently active 
  147. (non-pop-up) form in order to perform some operation, like switching to 
  148. Datasheet view.  In order to do this in the most generic way possible, 
  149. wu_GetCurrentDoc will first SetFocus back to Microsoft Access, thus 
  150. removing the focus from the pop-up tool palette.
  151.  
  152.  
  153. ShowWindow
  154.  
  155. If a window is maximized, you can use ShowWindow to restore it or 
  156. minimize it.  See IsZoomed for more information on how ShowWindow is 
  157. used in ORDENTRY.MDB.
  158.  
  159.