home *** CD-ROM | disk | FTP | other *** search
/ Dan Appleman's Visual Bas…s Guide to the Win32 API / Dan.Applmans.Visual.Basic.5.0.Programmers.Guide.To.The.Win32.API.1997.Ziff-Davis.Press.CD / VB5PG32.mdf / vbpg32 / samples4 / ch05 / ex5.bas < prev    next >
Encoding:
BASIC Source File  |  1996-02-16  |  12.1 KB  |  202 lines

  1. Attribute VB_Name = "CH5_Examples"
  2. Option Explicit
  3. ' Copyright ⌐ 1996 by Desaware. All Rights Reserved
  4. Type RECT
  5.         Left As Long
  6.         Top As Long
  7.         Right As Long
  8.         Bottom As Long
  9. End Type
  10.  
  11. Type SMALLRECT
  12.         Left As Integer
  13.         Top As Integer
  14.         Right As Integer
  15.         Bottom As Integer
  16. End Type
  17.  
  18.  
  19. Type POINTAPI
  20.         x As Long
  21.         y As Long
  22. End Type
  23.  
  24.  
  25. Type SIZE
  26.         cx As Long
  27.         cy As Long
  28. End Type
  29.  
  30. Type WNDCLASS
  31.     style As Long
  32.     lpfnwndproc As Long
  33.     cbClsextra As Long
  34.     cbWndExtra2 As Long
  35.     hInstance As Long
  36.     hIcon As Long
  37.     hCursor As Long
  38.     hbrBackground As Long
  39.     lpszMenuName As Long
  40.     lpszClassName As Long
  41. End Type
  42.  
  43. Type WNDCLASSEX
  44.     cbSize As Long
  45.     style As Long
  46.     lpfnwndproc As Long
  47.     cbClsextra As Long
  48.     cbWndExtra2 As Long
  49.     hInstance As Long
  50.     hIcon As Long
  51.     hCursor As Long
  52.     hbrBackground As Long
  53.     lpszMenuName As Long
  54.     lpszClassName As Long
  55.     hIconSm As Long
  56. End Type
  57.  
  58. Type WINDOWPLACEMENT
  59.         Length As Long
  60.         flags As Long
  61.         showCmd As Long
  62.         ptMinPosition As POINTAPI
  63.         ptMaxPosition As POINTAPI
  64.         rcNormalPosition As RECT
  65. End Type
  66.  
  67. Public Const GWL_WNDPROC = (-4)
  68. Public Const GWL_HINSTANCE = (-6)
  69. Public Const GWL_HWNDPARENT = (-8)
  70. Public Const GWL_STYLE = (-16)
  71. Public Const GWL_EXSTYLE = (-20)
  72. Public Const GWL_USERDATA = (-21)
  73. Public Const GWL_ID = (-12)
  74.  
  75. ' SetWindowPos Flags
  76. Public Const SWP_NOSIZE = &H1
  77. Public Const SWP_NOMOVE = &H2
  78. Public Const SWP_NOZORDER = &H4
  79. Public Const SWP_NOREDRAW = &H8
  80. Public Const SWP_NOACTIVATE = &H10
  81. Public Const SWP_FRAMECHANGED = &H20        '  The frame changed: send WM_NCCALCSIZE
  82. Public Const SWP_SHOWWINDOW = &H40
  83. Public Const SWP_HIDEWINDOW = &H80
  84. Public Const SWP_NOCOPYBITS = &H100
  85. Public Const SWP_NOOWNERZORDER = &H200      '  Don't do owner Z ordering
  86.  
  87. Public Const SWP_DRAWFRAME = SWP_FRAMECHANGED
  88. Public Const SWP_NOREPOSITION = SWP_NOOWNERZORDER
  89.  
  90. ' SetWindowPos() hwndInsertAfter values
  91. Public Const HWND_TOP = 0
  92. Public Const HWND_BOTTOM = 1
  93. Public Const HWND_TOPMOST = -1
  94. Public Const HWND_NOTOPMOST = -2
  95.  
  96. Public Const CWP_ALL = 0
  97. Public Const CWP_SKIPINVISIBLE = 1
  98. Public Const CWP_SKIPDISABLED = 2
  99. Public Const CWP_SKIPTRANSPARENT = 4
  100.  
  101. Declare Function AdjustWindowRect& Lib "user32" (lpRect As RECT, ByVal dwStyle As Long, ByVal bMenu As Long)
  102. Declare Function AdjustWindowRectEx& Lib "user32" (lpRect As RECT, ByVal dsStyle As Long, ByVal bMenu As Long, ByVal dwEsStyle As Long)
  103. Declare Function AnyPopup& Lib "user32" ()
  104. Declare Function ArrangeIconicWindows& Lib "user32" (ByVal hwnd As Long)
  105. Declare Function AttachThreadInput& Lib "user32" (ByVal idAttach As Long, ByVal idAttachTo As Long, ByVal fAttach As Long)
  106. Declare Function BeginDeferWindowPos& Lib "user32" (ByVal nNumWindows As Long)
  107. Declare Function BringWindowToTop& Lib "user32" (ByVal hwnd As Long)
  108. Declare Function CascadeWindows% Lib "user32" (ByVal hwndParent As Long, ByVal wHow As Long, lpRect As RECT, ByVal cKids As Long, lpKids As Long)
  109. Declare Function CascadeWindowsByNum% Lib "user32" Alias "CascadeWindows" (ByVal hwndParent As Long, ByVal wHow As Long, ByVal lpRect As Long, ByVal cKids As Long, ByVal lpKids As Long)
  110. Declare Function ChildWindowFromPoint& Lib "user32" (ByVal hwnd As Long, ByVal x As Long, ByVal y As Long)
  111. Declare Function ChildWindowFromPointEx& Lib "user32" (ByVal hwndParent As Long, ByVal ptx As Long, ByVal pty As Long, ByVal uFlags As Long)
  112. Declare Function ClientToScreen& Lib "user32" (ByVal hwnd As Long, lpPoint As POINTAPI)
  113. Declare Function CloseWindow& Lib "user32" (ByVal hwnd As Long)
  114. Declare Function CopyRect& Lib "user32" (lpDestRect As RECT, lpSourceRect As RECT)
  115. Declare Function DeferWindowPos& Lib "user32" (ByVal hWinPosInfo As Long, ByVal hwnd As Long, ByVal hWndInsertAfter As Long, ByVal x As Long, ByVal y As Long, ByVal cx As Long, ByVal cy As Long, ByVal wFlags As Long)
  116. Declare Function DestroyWindow& Lib "user32" (ByVal hwnd As Long)
  117. Declare Function DrawAnimatedRects& Lib "user32" (ByVal hwnd As Long, ByVal idAni As Long, lprcFrom As RECT, lprcTo As RECT)
  118. Declare Function EnableWindow& Lib "user32" (ByVal hwnd As Long, ByVal fEnable As Long)
  119. Declare Function EndDeferWindowPos& Lib "user32" (ByVal hWinPosInfo As Long)
  120. Declare Function EnumChildWindows& Lib "user32" (ByVal hwndParent As Long, ByVal lpEnumFunc As Long, ByVal lParam As Long)
  121. Declare Function EnumThreadWindows& Lib "user32" (ByVal dwThreadID As Long, ByVal lpfn As Long, ByVal lParam As Long)
  122. Declare Function EnumWindows& Lib "user32" (ByVal lpEnumFunc As Long, ByVal lParam As Long)
  123. Declare Function EqualRect& Lib "user32" (lpRect1 As RECT, lpRect2 As RECT)
  124. Declare Function FindWindow& Lib "user32" Alias "FindWindowA" (ByVal lpClassName As String, ByVal lpWindowName As String)
  125. Declare Function FindWindowEx& Lib "user32" Alias "FindWindowExA" (ByVal hwndParent As Long, ByVal hWndChildAfter As Long, ByVal lpClassName As String, ByVal lpWindowName As String)
  126. Declare Function FlashWindow& Lib "user32" (ByVal hwnd As Long, ByVal bInvert As Long)
  127. Declare Function GetActiveWindow& Lib "user32" ()
  128. Declare Function GetCapture& Lib "user32" ()
  129. Declare Function GetClassInfo& Lib "user32" Alias "GetClassInfoA" (ByVal hInstance As Long, ByVal lpClassName As String, lpWndClass As WNDCLASS)
  130. Declare Function GetClassInfoEx& Lib "user32" Alias "GetClassInfoExA" (ByVal hInstance As Long, ByVal lpClassName As String, lpWndClassEx As WNDCLASSEX)
  131. Declare Function GetClassLong& Lib "user32" Alias "GetClassLongA" (ByVal hwnd As Long, ByVal nIndex As Long)
  132. Declare Function GetClassName& Lib "user32" Alias "GetClassNameA" (ByVal hwnd As Long, ByVal lpClassName As String, ByVal nMaxCount As Long)
  133. Declare Function GetClassWord& Lib "user32" (ByVal hwnd As Long, ByVal nIndex As Long)
  134. Declare Function GetClientRect& Lib "user32" (ByVal hwnd As Long, lpRect As RECT)
  135. Declare Function GetDesktopWindow& Lib "user32" ()
  136. Declare Function GetFocus& Lib "user32" ()
  137. Declare Function GetForegroundWindow& Lib "user32" ()
  138. Declare Function GetLastActivePopup& Lib "user32" (ByVal hwndOwnder As Long)
  139. Declare Function GetParent& Lib "user32" (ByVal hwnd As Long)
  140. Declare Function GetTopWindow& Lib "user32" (ByVal hwnd As Long)
  141. Declare Function GetUpdateRect& Lib "user32" (ByVal hwnd As Long, lpRect As RECT, ByVal bErase As Long)
  142. Declare Function GetWindow& Lib "user32" (ByVal hwnd As Long, ByVal wCmd As Long)
  143. Declare Function GetWindowContextHelpId& Lib "user32" (ByVal hwnd As Long)
  144. Declare Function GetWindowLong& Lib "user32" Alias "GetWindowLongA" (ByVal hwnd As Long, ByVal nIndex As Long)
  145. Declare Function GetWindowPlacement& Lib "user32" (ByVal hwnd As Long, lpwndpl As WINDOWPLACEMENT)
  146. Declare Function GetWindowRect& Lib "user32" (ByVal hwnd As Long, lpRect As RECT)
  147. Declare Function GetWindowText& Lib "user32" Alias "GetWindowTextA" (ByVal hwnd As Long, ByVal lpString As String, ByVal cch As Long)
  148. Declare Function GetWindowTextLength& Lib "user32" Alias "GetWindowTextLengthA" (ByVal hwnd As Long)
  149. Declare Function GetWindowWord% Lib "user32" (ByVal hwnd As Long, ByVal nIndex As Long)
  150. Declare Function InflateRect& Lib "user32" (lpRect As RECT, ByVal x As Long, ByVal y As Long)
  151. Declare Function IntersectRect& Lib "user32" (lpDestRect As RECT, lpSrc1Rect As RECT, lpSrc2Rect As RECT)
  152. Declare Function InvalidateRect& Lib "user32" (ByVal hwnd As Long, lpRect As RECT, ByVal bErase As Long)
  153. Declare Function InvalidateRectBynum& Lib "user32" Alias "InvalidateRect" (ByVal hwnd As Long, ByVal lpRect As Long, ByVal bErase As Long)
  154. Declare Function IsChild& Lib "user32" (ByVal hwndParent As Long, ByVal hwnd As Long)
  155. Declare Function IsIconic& Lib "user32" (ByVal hwnd As Long)
  156. Declare Function IsRectEmpty& Lib "user32" (lpRect As RECT)
  157. Declare Function IsWindow& Lib "user32" (ByVal hwnd As Long)
  158. Declare Function IsWindowEnabled& Lib "user32" (ByVal hwnd As Long)
  159. Declare Function IsWindowUnicode& Lib "user32" (ByVal hwnd As Long)
  160. Declare Function IsWindowVisible& Lib "user32" (ByVal hwnd As Long)
  161. Declare Function IsZoomed& Lib "user32" (ByVal hwnd As Long)
  162. Declare Function LockWindowUpdate& Lib "user32" (ByVal hwndLock As Long)
  163. Declare Function MapWindowPoints& Lib "user32" (ByVal hwndFrom As Long, ByVal hwndTo As Long, lppt As POINTAPI, ByVal cPoints As Long)
  164. Declare Function MoveWindow& Lib "user32" (ByVal hwnd As Long, ByVal x As Long, ByVal y As Long, ByVal nWidth As Long, ByVal nHeight As Long, ByVal bRepaint As Long)
  165. Declare Function OffsetRect& Lib "user32" (lpRect As RECT, ByVal x As Long, ByVal y As Long)
  166. Declare Function OpenIcon& Lib "user32" (ByVal hwnd As Long)
  167. Declare Function PtInRect& Lib "user32" (lpRect As RECT, ByVal ptx As Long, ByVal pty As Long)
  168. Declare Function RedrawWindow& Lib "user32" (ByVal hwnd As Long, lprcUpdate As RECT, ByVal hrgnUpdate As Long, ByVal fuRedraw As Long)
  169. Declare Function ReleaseCapture& Lib "user32" ()
  170. Declare Function ScreenToClient& Lib "user32" (ByVal hwnd As Long, lpPoint As POINTAPI)
  171. Declare Function ScrollWindow& Lib "user32" (ByVal hwnd As Long, ByVal XAmount As Long, ByVal YAmount As Long, lpRect As RECT, lpClipRect As RECT)
  172. Declare Function ScrollWindowEx& Lib "user32" (ByVal hwnd As Long, ByVal dx As Long, ByVal dy As Long, lprcScroll As RECT, lprcClip As RECT, ByVal hrgnUpdate As Long, lprcUpdate As RECT, ByVal fuScroll As Long)
  173. Declare Function SetActiveWindow& Lib "user32" (ByVal hwnd As Long)
  174. Declare Function SetCapture& Lib "user32" (ByVal hwnd As Long)
  175. Declare Function SetClassLong& Lib "user32" Alias "SetClassLongA" (ByVal hwnd As Long, ByVal nIndex As Long, ByVal dwNewLong As Long)
  176. Declare Function SetClassWord& Lib "user32" (ByVal hwnd As Long, ByVal nIndex As Long, ByVal wNewWord As Long)
  177. Declare Function SetFocusAPI& Lib "user32" Alias "SetFocus" (ByVal hwnd As Long)
  178. Declare Function SetForegroundWindow& Lib "user32" (ByVal hwnd As Long)
  179. Declare Function SetParent& Lib "user32" (ByVal hWndChild As Long, ByVal hWndNewParent As Long)
  180. Declare Function SetRect& Lib "user32" (lpRect As RECT, ByVal X1 As Long, ByVal Y1 As Long, ByVal X2 As Long, ByVal Y2 As Long)
  181. Declare Function SetRectEmpty& Lib "user32" (lpRect As RECT)
  182. Declare Function SetWindowContextHelpId& Lib "user32" (ByVal hwnd As Long, ByVal dwContextHelpId As Long)
  183. Declare Function SetWindowLong& Lib "user32" Alias "SetWindowLongA" (ByVal hwnd As Long, ByVal nIndex As Long, ByVal dwNewLong As Long)
  184. Declare Function SetWindowPlacement& Lib "user32" (ByVal hwnd As Long, lpwndpl As WINDOWPLACEMENT)
  185. Declare Function SetWindowPos& Lib "user32" (ByVal hwnd As Long, ByVal hWndInsertAfter As Long, ByVal x As Long, ByVal y As Long, ByVal cx As Long, ByVal cy As Long, ByVal wFlags As Long)
  186. Declare Function SetWindowText& Lib "user32" Alias "SetWindowTextA" (ByVal hwnd As Long, ByVal lpString As String)
  187. Declare Function SetWindowWord& Lib "user32" (ByVal hwnd As Long, ByVal nIndex As Long, ByVal wNewWord As Long)
  188. Declare Function ShowOwnedPopups& Lib "user32" (ByVal hwnd As Long, ByVal fShow As Long)
  189. Declare Function ShowWindow& Lib "user32" (ByVal hwnd As Long, ByVal nCmdShow As Long)
  190. Declare Function ShowWindowAsync& Lib "user32" (ByVal hwnd As Long, ByVal nCmdShow As Long)
  191. Declare Function SubtractRect& Lib "user32" (lprcDst As RECT, lprcSrc1 As RECT, lprcSrc2 As RECT)
  192. Declare Function TileWindows% Lib "user32" (ByVal hwndParent As Long, ByVal wHow As Long, lpRect As RECT, ByVal cKids As Long, lpKids As Long)
  193. Declare Function TileWindowsBynum% Lib "user32" Alias "TileWindows" (ByVal hwndParent As Long, ByVal wHow As Long, ByVal lpRect As Long, ByVal cKids As Long, ByVal lpKids As Long)
  194. Declare Function UnionRect& Lib "user32" (lpDestRect As RECT, lpSrc1Rect As RECT, lpSrc2Rect As RECT)
  195. Declare Function UpdateWindow& Lib "user32" (ByVal hwnd As Long)
  196. Declare Function ValidateRect& Lib "user32" (ByVal hwnd As Long, lpRect As RECT)
  197. Declare Function ValidateRectBynum& Lib "user32" Alias "ValidateRect" (ByVal hwnd As Long, ByVal lpRect As Long)
  198. Declare Function WindowFromPoint& Lib "user32" (ByVal x As Long, ByVal y As Long)
  199.  
  200. Declare Function da& Lib "user32" Alias "DrawAnimatedRects" (ByVal hwnd As Long, ByVal idAni As Long, lprcFrom As SMALLRECT, lprcTo As SMALLRECT)
  201.  
  202.