home *** CD-ROM | disk | FTP | other *** search
- VERSION 1.0 CLASS
- BEGIN
- MultiUse = -1 'True
- END
- Attribute VB_Name = "Help"
- Attribute VB_Creatable = True
- Attribute VB_Exposed = True
- ' Help class -- HELP.CLS
- ' Provides access to WinAPI Help functions.
- '
- ' Properties
- ' OnTop (Read/Write)
- ' hWnd (Read/Write)
- ' FileName (Read/Write)
- ' Keyword (Read/Write)
- '
- ' Methods
- ' Show
- '
- Option Explicit
-
- #If Win16 Then
- ' Help engine declarations.
- Private Declare Function WinHelp Lib "User" _
- (ByVal hwnd As Integer, _
- ByVal lpszFileName As String, _
- ByVal wCmd As Integer, _
- dwData As Any) As Integer
- ' Win API declaration and constants used by OnTop property.
- Private Declare Sub SetWindowPos Lib "User" _
- (ByVal hwnd As Integer, _
- ByVal hWndInsertAfter As Integer, _
- ByVal x As Integer, ByVal y As Integer, _
- ByVal cx As Integer, ByVal cy As Integer, _
- ByVal wFlags As Integer)
- #Else
- Private 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) As Long
- Private Declare Function WinHelp Lib "user32" _
- Alias "WinHelpA" (ByVal hwnd As Long, _
- ByVal lpHelpFile As String, _
- ByVal wCommand As Long, _
- ByVal dwData As Long) As Long
- #End If
- ' Commands to pass WinHelp()
- Const HELP_CONTEXT = &H1 ' Display topic in ulTopic
- Const HELP_QUIT = &H2 ' Terminate help
- Const HELP_INDEX = &H3 ' Display index
- Const HELP_HELPONHELP = &H4 ' Display help on using help
- Const HELP_SETINDEX = &H5 ' Set current Index for multi index help
- Const HELP_KEY = &H101 ' Display topic for keyword in offabData
- Const HELP_PARTIALKEY = &H105&
- Const HELP_MULTIKEY = &H201&
- ' Constants for SetWindowPos
- Const SWP_NOACTIVATE = &H10
- Const SWP_SHOWWINDOW = &H40
- Const SWP_NOSIZE = &H1
- Const SWP_NOMOVE = &H2
- Const HWND_TOPMOST = -1
- Const HWND_NOTOPMOST = -2
-
- ' Flag used by OnTop property to track window state.
- Dim mbOnTop As Boolean
-
- ' Help properties.
- Public hwnd As Integer
- Public FileName As String
- Public Keyword As String
-
- Public Sub Show()
- Dim Temp
- Temp = WinHelp(hwnd, FileName, _
- HELP_KEY, ByVal Keyword)
- End Sub
-
-
- ' Assigns the OnTop property.
- Property Let OnTop(bSetting As Boolean)
- ' If True, Form is displayed as always on top.
- If bSetting Then
- SetWindowPos hwnd, _
- HWND_TOPMOST, _
- 0, 0, 0, 0, _
- SWP_NOSIZE Or SWP_NOMOVE _
- Or SWP_NOACTIVATE Or SWP_SHOWWINDOW
- ' Set flag to keep track of window state.
- mbOnTop = True
- ' If False, Form is displayed normally.
- Else
- SetWindowPos hwnd, _
- HWND_NOTOPMOST, _
- 0, 0, 0, 0, _
- SWP_NOSIZE Or SWP_NOMOVE _
- Or SWP_NOACTIVATE
- ' Set flag to keep track of window state.
- mbOnTop = False
- End If
- End Property
-
- ' Returns True if the form is displayed as always on top,
- ' otherwise returns false.
- Property Get OnTop() As Boolean
- ' Return the value of the flag set by Property Let.
- OnTop = mbOnTop
- End Property
-
-