home *** CD-ROM | disk | FTP | other *** search
/ Programming Tool Box / SIMS_2.iso / code / system / callback / cb.bas < prev    next >
Encoding:
BASIC Source File  |  1995-02-27  |  6.1 KB  |  172 lines

  1. Option Explicit
  2. Global Const MSG_IGNORE = 0
  3. Global Const MSG_PREPROCESS = 1
  4. Global Const MSG_POSTPROCESS = 2
  5. Global Const MSG_EAT = 3
  6.  
  7. Declare Function GetTag$ Lib "callback.vbx" (ByVal hWnd%) 'ermittelt tag eines controls, dessen fensterhandle ⁿbergeben wurde ("" wenn hWnd kein Control-Fenster oder kein Tag angegeben)
  8. Declare Function GetInstance% Lib "callback.vbx" ()
  9. Declare Sub TypeAtAdress Lib "callback.vbx" (dst As Any, adr As Any, ByVal l%)
  10. Declare Function StringAtAdress$ Lib "callback.vbx" (ByVal adr As Any) 'Wandelt sz-string an der ⁿbergebenen adresse in eine vb-string
  11. Declare Function IntegerAtAdress% Lib "callback.vbx" (ByVal adr&) 'Wandelt sz-string an der ⁿbergebenen adresse in eine vb-string
  12. Declare Function LongAtAdress& Lib "callback.vbx" (ByVal adr&) 'Wandelt sz-string an der ⁿbergebenen adresse in eine vb-string
  13. Declare Function loword% Lib "callback.vbx" (ByVal l&)  'Wandelt sz-string an der ⁿbergebenen adresse in eine vb-string
  14. Declare Function hiword% Lib "callback.vbx" (ByVal l&)  'Wandelt sz-string an der ⁿbergebenen adresse in eine vb-string
  15. Declare Function MAKELONG& Lib "callback.vbx" (ByVal l%, ByVal h%)  'Wandelt sz-string an der ⁿbergebenen adresse in eine vb-string
  16.  
  17.  
  18. 'Nicht in WIN30API.TXT und WIN31EXT.TXT definierte Funktionen
  19. Declare Function EnumFonts% Lib "GDI" (ByVal hdc%, lpszFace As Any, ByVal CBA&, UD As Any)
  20. Declare Function EnumFontFamilies% Lib "GDI" (ByVal hdc%, lpszFace As Any, ByVal CBA&, UD As Any)
  21.  
  22. Declare Function EnumObjects% Lib "GDI" (ByVal hdc%, ByVal fnObjectType%, ByVal CBA&, UD As Any)
  23. Global Const OBJ_PEN% = 1
  24. Global Const OBJ_BRUSH% = 2
  25.  
  26. Declare Sub LineDDA Lib "GDI" (ByVal nXStart%, ByVal nYStart%, ByVal nXEnd%, ByVal nYEnd%, ByVal CBA&, UD As Any)
  27.  
  28. Declare Function SetPropAtom Lib "User" Alias "SetProp" (ByVal hWnd As Integer, ByVal atom As Long, ByVal hData As Integer) As Integer
  29. Declare Function enumprops% Lib "User" (ByVal hWnd%, ByVal CBA&)
  30.  
  31. Declare Function EnumWindows% Lib "user" (ByVal CBA&, UD As Any)
  32. Declare Function EnumChildWindows% Lib "user" (ByVal hWnd%, ByVal CBA&, UD As Any)
  33. Declare Function EnumTaskWindows% Lib "user" (ByVal hTask%, ByVal CBA&, UD As Any)
  34.  
  35. Declare Function EnumMetaFile% Lib "GDI" (ByVal hdc%, ByVal hmf%, ByVal CBA&, ByVal UD As Any)
  36.  
  37. Declare Function GrayString% Lib "USER" (ByVal hdc%, ByVal hbr%, ByVal CBA&, ByVal lparam&, ByVal cch%, ByVal x%, ByVal y%, ByVal cx%, ByVal cy%)
  38.  
  39.  
  40. Declare Function SetAbortProcAPI Lib "GDI" Alias "SetAbortProc" (ByVal hdc%, ByVal CBA&)
  41.  
  42. Declare Function SetWindowsHookEx& Lib "User" (ByVal idHook%, ByVal CBA&, ByVal hinst%, ByVal hTask%)
  43.  
  44. Global Const WH_MOUSE = 7
  45. Type MOUSEHOOKSTRUCT
  46.     x As Integer 'pt As pointapi
  47.     y As Integer
  48.     hWnd As Integer
  49.     wHitTestCode As Integer
  50.     dwExtraInfo As Long
  51. End Type
  52.  
  53. Global Const NF_NORMAL = 0
  54. Global Const NF_TASKSWITCH = 1
  55. Global Const NF_RIP = 2
  56. Declare Function NotifyRegister% Lib "ToolHelp.DLL" (ByVal hTask%, ByVal adr&, ByVal id%)
  57.  
  58. Declare Function CallWindowProc& Lib "User" (ByVal owndproc&, ByVal hWnd%, ByVal wmsg%, ByVal wparam%, ByVal lparam&)
  59. 'Global Const SRCAND& = &H8800C6
  60. 'Global Const SRCINVERT& = &H660046
  61.  
  62. 'Declare Function BitBlt% Lib "GDI" (ByVal hdcDest%, ByVal nXDest%, ByVal nYDest%, ByVal nWidth%, ByVal nHeight%, ByVal hdcSrc%, ByVal nXSrc%, ByVal nYSrc%, ByVal dwRop%)
  63.  
  64. Global GlobalControlRect As Rect
  65. Global Win%
  66.  
  67. Global Const NFY_UNKNOWN = 0
  68.  
  69. 'NFY_LOADSEG:  dwData points to a NFYLOADSEG structure
  70. Global Const NFY_LOADSEG = 1
  71. Type NFYLOADSEG
  72.     dwSize As Long
  73.     wSelector As Integer
  74.     wSegNum As Integer
  75.     wType As Integer  ' Low bit set if data seg, clear if code seg
  76.     wcInstance As Integer        ' Instance count ONLY VALID FOR DATA SEG
  77.     lpstrModuleName As Long 'C-String
  78. End Type
  79. ' NFY_FREESEG:  LOWORD(dwData) is the selector of the segment being freed
  80. Global Const NFY_FREESEG = 2
  81.  
  82. ' NFY_STARTDLL:  dwData points to a NFYSTARTDLL structure
  83. Global Const NFY_STARTDLL = 3
  84. Type NFYSTARTDLL
  85.     dwSize As Long
  86.     hModule As Integer
  87.     wCS As Integer
  88.     wIP As Integer
  89. End Type
  90.  
  91. 'NFY_STARTTASK:  dwData is the CS:IP of the start address of the task
  92. Global Const NFY_STARTTASK = 4
  93.  
  94. ' NFY_EXITTASK:  The low byte of dwData contains the program exit code
  95. Global Const NFY_EXITTASK = 5
  96.  
  97. ' NFY_DELMODULE:  LOWORD(dwData) is the handle of the module to be freed
  98. Global Const NFY_DELMODULE = 6
  99.  
  100. ' NFY_RIP:  dwData points to a NFYRIP structure
  101. Global Const NFY_RIP = 7
  102. Type NFYRIP
  103.     dwSize As Long
  104.     wIP As Integer
  105.     wCS As Integer
  106.     wSS As Integer
  107.     wBP As Integer
  108.     wExitCode As Integer
  109. End Type
  110.  
  111. ' NFY_TASKIN:  No data.  Callback should do GetCurrentTask()
  112. Global Const NFY_TASKIN = 8
  113.  
  114. 'NFY_TASKOUT:  No data.  Callback should do GetCurrentTask()
  115. Global Const NFY_TASKOUT = 9
  116.  
  117. ' NFY_INCHAR:  Return value from callback is used.  If NULL, mapped to 'i'
  118. Global Const NFY_INCHAR = 10
  119.  
  120. ' NFY_OUTSTR:  dwData points to the string to be displayed
  121. Global Const NFY_OUTSTR = 11
  122.  
  123. ' NFY_LOGERROR:  dwData points to a NFYLOGERROR struct
  124. Global Const NFY_LOGERROR = 12
  125. Type NFYLOGERROR
  126.     dwSize As Long
  127.     wErrCode As Integer
  128.     lpInfo As Long ' Error code-dependent
  129. End Type
  130.  
  131. ' NFY_LOGPARAMERROR:  dwData points to a NFYLOGPARAMERROR struct
  132. Global Const NFY_LOGPARAMERROR = 13
  133. Type NFYLOGPARAMERROR
  134.      dwSize As Long
  135.      wErrCode As Integer
  136.      lpfnErrorAddr As Long
  137.      lpBadParam As Long
  138. End Type
  139.  
  140. Function HasFocus% (ByVal h%)
  141.   If GetFocus() = h Or GetActiveWindow() = h Then
  142.     HasFocus = True
  143.   Else
  144.     If GetParent(h) Then
  145.       HasFocus = HasFocus(GetParent(h))
  146.     End If
  147.   End If
  148. End Function
  149.  
  150. Function hibyte% (ByVal w%)
  151.   w% = Int(w% / 256)
  152.   If w% < 0 Then w% = w% + 256
  153.   hibyte = w%
  154. End Function
  155.  
  156. Function lobyte% (ByVal w%)
  157.   lobyte = w% And 255
  158. End Function
  159.  
  160. Sub SetQuickTip (s$, c As Control)
  161.   If HasFocus(c.hWnd) Then
  162.     Win = c.hWnd
  163.     GetWindowRect c.hWnd, GlobalControlRect
  164.     frmQuickHelp.Text = s
  165.     frmQuickHelp.Timer1.Interval = 500
  166.   Else
  167.     frmQuickHelp.Text = ""
  168.     frmQuickHelp.Timer1.Interval = 0
  169.   End If
  170. End Sub
  171.  
  172.