home *** CD-ROM | disk | FTP | other *** search
- Attribute VB_Name = "Module1"
- Global Const SW_SHOWNOACTIVATE = 4
- Global Const GW_CHILD = 5 ' Needed for edit portion of
- ' combo box
- Type POINTAPI ' Stores location of cursor
- X As Long
- Y As Long
- End Type
-
- Declare Function GetCursorPos Lib "user32" (lpPoint As POINTAPI) As Long
- Declare Function GetActiveWindow Lib "user32" () As Long
- Declare Function WindowFromPoint Lib "user32" (ByVal X As Long, ByVal Y As Long) As Long
- Declare Function GetWindow Lib "user32" (ByVal hwnd As Long, ByVal wCmd As Long) As Long
- Declare Function ShowWindow Lib "user32" (ByVal hwnd As Long, ByVal nCmdShow As Long) As Long
-
-
-
- Sub DisplayHelp(Help$)
- Dim lpPoint As POINTAPI ' Cursor Point variable
- Dim ret As Long ' Return value of ShowWindow()
- ' API function
- Rem Display Help String
- Rem
- Rem This Function displays the Help$ if Help$ <> "".
- Rem if Help$ = "" then the Help String is removed.
- Rem
- Rem FUNCTION REQUIREMENTS:
- Rem GetCursorPos() Windows API function
- Rem frmHelp Name of the Help form
- Rem
-
- If Len(Help$) <> 0 Then ' Double check help$
-
- ' Make sure help form is invisible:
- FrmHelp.Hide
-
- ' Change caption of label:
- FrmHelp.Label1.Caption = Help$
-
- ' Get the cursor position so you can calculate where
- ' to place the help form:
- Call GetCursorPos(lpPoint)
-
- ' Offset the form from the cursor by 18 and 2 pixels (values
- ' chosen to simulate the look of Microsoft Word version 6.0)
- FrmHelp.Top = (lpPoint.Y + 18) * Screen.TwipsPerPixelY
- FrmHelp.Left = (lpPoint.X - 2) * Screen.TwipsPerPixelY
-
- ' Adjust width of form to label + 4 because 2 are needed
- ' for each pixel of the border and 2 are needed to center
- ' the label (the label is inset by 1 pixel on the form).
- ' Also, adjust height of form to height of label + 2
- ' because 2 ar needed for each pixel of the border:
- FrmHelp.Width = FrmHelp.Label1.Width + (4 * Screen.TwipsPerPixelX)
- FrmHelp.Height = FrmHelp.Label1.Height + 2 * Screen.TwipsPerPixelY
-
- ' Make sure form is on top:
- FrmHelp.ZOrder
-
- ' Show form without the focus:
- ret = ShowWindow(FrmHelp.hwnd, SW_SHOWNOACTIVATE)
- Else
- ' Hide the form:
- FrmHelp.Hide
- End If
- End Sub
-