home *** CD-ROM | disk | FTP | other *** search
/ Visual Basic 4 Unleashed / Visual_Basic_4_Unleashed_SAMS_Publishing_1995.iso / crystal / extras / crpedemo / crpedemo.bas < prev    next >
Encoding:
BASIC Source File  |  1994-12-15  |  3.9 KB  |  115 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.  
  27. 'ToolTips Declarations
  28.  
  29. Global Const SW_SHOWNOACTIVATE = 4
  30. 'Global Const GW_CHILD = 5         ' Needed for edit portion of combo box
  31.  
  32. Type POINTAPI       ' Stores location of cursor
  33.    x As Integer
  34.    y As Integer
  35. End Type
  36.  
  37. Declare Sub GetCursorPos Lib "User" (lpPoint As POINTAPI)
  38. Declare Function GetActiveWindow Lib "User" () As Integer
  39.   ' Enter each of the following Declare statements on one, single lin
  40.  
  41. Declare Function WindowFromPoint Lib "user" (ByVal lpPointY As Integer, ByVal lpPointX As Integer) As Integer
  42. 'Declare Function GetWindow Lib "User" (ByVal hWnd As Integer, ByVal wCmd As Integer) As Integer
  43. Declare Function ShowWindow Lib "User" (ByVal hWnd As Integer, ByVal nCmdShow As Integer) As Integer
  44.  
  45. Sub DisplayHelp (Help$)
  46.        Dim lpPoint As POINTAPI ' Cursor Point variable
  47.        Dim ret As Integer      ' Return value of ShowWindow() API function
  48.  
  49.        Rem Display Help String
  50.        Rem
  51.        Rem This Function displays the Help$ if Help$ <> "".
  52.        Rem if Help$ = "" then the Help String is removed.
  53.        Rem
  54.        Rem FUNCTION REQUIREMENTS:
  55.        Rem     GetCursorPos()    Windows API function
  56.        Rem     frmHelp           Name of the Help form
  57.        Rem
  58.  
  59.        If Len(Help$) <> 0 Then  ' Double check help$
  60.  
  61.           ' Make sure help form is invisible:
  62.           frmHelp.Hide
  63.  
  64.           ' Change caption of label:
  65.           frmHelp.Label1.Caption = Help$
  66.  
  67.           ' Get the cursor position so you can calculate where to place the
  68.           ' help form:
  69.           Call GetCursorPos(lpPoint)
  70.  
  71.           ' Offset the form from the cursor by 18 and 2 pixels (values
  72.           ' chosen to simulate the look of Microsoft Word version 6.0)
  73.           frmHelp.Top = (lpPoint.y + 18) * Screen.TwipsPerPixelY
  74.           frmHelp.Left = (lpPoint.x - 2) * Screen.TwipsPerPixelY
  75.  
  76.           ' Adjust width of form to label + 4  because 2 are needed for each
  77.           ' pixel of the border and 2 are needed to center the label (
  78.  
  79.           ' label is inset by 1 pixel on the form). Also, adjust height of
  80.           ' form to height of label + 2 because 2 ar needed for each pixel
  81.           ' of the border:
  82.           frmHelp.Width = frmHelp.Label1.Width + (4 * Screen.TwipsPerPixelX)
  83.           frmHelp.Height = frmHelp.Label1.Height + 2 * Screen.TwipsPerPixelY
  84.  
  85.           ' Make sure form is on top:
  86.           frmHelp.ZOrder
  87.  
  88.           ' Show form without the focus:
  89.           ret = ShowWindow(frmHelp.hWnd, SW_SHOWNOACTIVATE)
  90.        Else
  91.           ' Hide the form:
  92.           frmHelp.Hide
  93.        End If
  94.     End Sub
  95.  
  96. Function GetErrorString (jobnum As Integer) As String
  97.   
  98.   Dim TextHandle As Integer, TextLength As Integer
  99.   Dim ErrorString As String
  100.   
  101.   
  102.   ErrorCode = PEGetErrorCode(jobnum)
  103.  
  104.   result% = PEGetErrorText(jobnum, TextHandle, TextLength)
  105.   
  106.   ErrorString = String$(TextLength + 1, " ")
  107.  
  108.   result% = PEGetHandleString(TextHandle, ErrorString, TextLength)
  109.  
  110.   GetErrorString = ErrorString
  111.   
  112.   
  113. End Function
  114.  
  115.