Microsoft KB Archive/86771

= How to Invoke Search in Windows Help from Visual Basic Program =

Article ID: 86771

Article Last Modified on 12/12/2003

-

APPLIES TO


 * Microsoft Visual Basic 2.0 Standard Edition
 * Microsoft Visual Basic 3.0 Professional Edition
 * Microsoft Visual Basic 2.0 Professional Edition
 * Microsoft Visual Basic 3.0 Professional Edition
 * Microsoft Visual Basic 1.0 Standard Edition
 * Microsoft Windows 3.0 Standard Edition
 * Microsoft Windows 3.1 Standard Edition

-



This article was previously published under Q86771



SUMMARY
You can invoke the Search feature of the Windows version 3.0 and 3.1 Help engine from a Visual Basic program. To do this, call the Windows API function WinHelp and pass the constant HELP_PARTIALKEY (&H105) as the wCommand parameter and any string that is a NON-valid topic as the dwData parameter.



Step-by-Step Example
 Start Visual Basic or from the File menu, choose New Project (ALT, F, N) if Visual Basic is already running. Form1 is created by default.  In GLOBAL.BAS (or the .BAS file of your choice in Visual Basic version 2.0), add this code: Global Const HELP_PARTIALKEY = &H105 ' Enter the following Declare statement entirely on one, single line. Declare Function WinHelp Lib &quot;User&quot;(ByVal hWnd As Integer,     ByVal lpHelpFile As String, ByVal wCommand As Integer,      ByVal dwData As Any) As Integer   In the Form1 Click event procedure, add this code: Sub Form_Click DummyVal$ = &quot;&quot; ' Enter the following function call entirely on one, single line: Temp% = WinHelp(Form1.hWnd, &quot;c:\Windows\winhelp.hlp&quot;,        HELP_PARTIALKEY, DummyVal$) End Sub  Press F5 to run this example. Click the form.

Additional query words: 2.00

Keywords: KB86771

-

[mailto:TECHNET@MICROSOFT.COM Send feedback to Microsoft]

© Microsoft Corporation. All rights reserved.