home *** CD-ROM | disk | FTP | other *** search
/ Visual Basic 4 Unleashed / Visual_Basic_4_Unleashed_SAMS_Publishing_1995.iso / crystal / extras / vbxdemo / vbxdemo.bas < prev    next >
Encoding:
BASIC Source File  |  1994-12-15  |  3.7 KB  |  102 lines

  1. 'CRPEDemo application specific Declarations
  2. '--------------------------------------------------------------------------------------------------
  3.  
  4. Declare Function GetWindow Lib "User" (ByVal hWnd As Integer, ByVal code As Integer) As Integer
  5. Declare Sub MoveWindow Lib "User" (ByVal hWnd As Integer, ByVal l As Integer, ByVal t As Integer, ByVal w As Integer, ByVal h As Integer, ByVal redraw As Integer)
  6. Global Const GW_CHILD = 5
  7. Global jobnum As Integer
  8. Global TableN As Integer
  9. Global SortN As Integer
  10. Global FormulaName As String
  11. Global SectionCode As Integer
  12. Global ScopeCode As Integer
  13. Global CRWFontName As String
  14. Global CRWFontSize As Integer
  15. Global CRWFontItalic As Integer
  16. Global CRWFontUnderLine As Integer
  17. Global CRWFontStrikeThru As Integer
  18. Global ErrorCode As Integer
  19. Global FieldType As Integer
  20. Global SortDir As Integer
  21. Global BoolCond1 As Integer
  22. Global DateCond1 As Integer
  23. Global GroupCondfield As String
  24. Global GraphNo As Integer
  25. Global SCode As Integer
  26. Global CancelCheck As Integer
  27. Global ToList(0 To 10) As String
  28. Global Sect As String
  29. Global GType As String
  30. Global BarDir As String
  31.  
  32.  
  33. 'ToolTips Declarations
  34.  
  35. Global Const SW_SHOWNOACTIVATE = 4
  36. 'Global Const GW_CHILD = 5         ' Needed for edit portion of combo box
  37.  
  38. Type POINTAPI       ' Stores location of cursor
  39.    x As Integer
  40.    y As Integer
  41. End Type
  42.  
  43. Declare Sub GetCursorPos Lib "User" (lpPoint As POINTAPI)
  44. Declare Function GetActiveWindow Lib "User" () As Integer
  45.   ' Enter each of the following Declare statements on one, single lin
  46.  
  47. Declare Function WindowFromPoint Lib "user" (ByVal lpPointY As Integer, ByVal lpPointX As Integer) As Integer
  48. 'Declare Function GetWindow Lib "User" (ByVal hWnd As Integer, ByVal wCmd As Integer) As Integer
  49. Declare Function ShowWindow Lib "User" (ByVal hWnd As Integer, ByVal nCmdShow As Integer) As Integer
  50.  
  51. Sub DisplayHelp (Help$)
  52.        Dim lpPoint As POINTAPI ' Cursor Point variable
  53.        Dim ret As Integer      ' Return value of ShowWindow() API function
  54.  
  55.        Rem Display Help String
  56.        Rem
  57.        Rem This Function displays the Help$ if Help$ <> "".
  58.        Rem if Help$ = "" then the Help String is removed.
  59.        Rem
  60.        Rem FUNCTION REQUIREMENTS:
  61.        Rem     GetCursorPos()    Windows API function
  62.        Rem     frmHelp           Name of the Help form
  63.        Rem
  64.  
  65.        If Len(Help$) <> 0 Then  ' Double check help$
  66.  
  67.           ' Make sure help form is invisible:
  68.           frmHelp.Hide
  69.  
  70.           ' Change caption of label:
  71.           frmHelp.Label1.Caption = Help$
  72.  
  73.           ' Get the cursor position so you can calculate where to place the
  74.           ' help form:
  75.           Call GetCursorPos(lpPoint)
  76.  
  77.           ' Offset the form from the cursor by 18 and 2 pixels (values
  78.           ' chosen to simulate the look of Microsoft Word version 6.0)
  79.           frmHelp.Top = (lpPoint.y + 18) * Screen.TwipsPerPixelY
  80.           frmHelp.Left = (lpPoint.x - 2) * Screen.TwipsPerPixelY
  81.  
  82.           ' Adjust width of form to label + 4  because 2 are needed for each
  83.           ' pixel of the border and 2 are needed to center the label (
  84.  
  85.           ' label is inset by 1 pixel on the form). Also, adjust height of
  86.           ' form to height of label + 2 because 2 ar needed for each pixel
  87.           ' of the border:
  88.           frmHelp.Width = frmHelp.Label1.Width + (4 * Screen.TwipsPerPixelX)
  89.           frmHelp.Height = frmHelp.Label1.Height + 2 * Screen.TwipsPerPixelY
  90.  
  91.           ' Make sure form is on top:
  92.           frmHelp.ZOrder
  93.  
  94.           ' Show form without the focus:
  95.           ret = ShowWindow(frmHelp.hWnd, SW_SHOWNOACTIVATE)
  96.        Else
  97.           ' Hide the form:
  98.           frmHelp.Hide
  99.        End If
  100.     End Sub
  101.  
  102.