How to Call a Windows Help Search Macro by Using Code

Last reviewed: November 29, 1995
Article ID: Q138781
The information in this article applies to:
  • Microsoft Visual FoxPro for Windows, version 3.0

SUMMARY

This article shows by example how to use program code to invoke Windows Help and open the Search macro.

MORE INFORMATION

Developers who write a custom Windows Help file for their application may also want to include program code that invokes their help session and goes immediately to the Search macro. This can be done with one of the following examples.

NOTE: For backward compatibility, Visual FoxPro still supports FOXTOOLS.FLL (included in earlier FoxPro versions), the Visual FoxPro API library that allows calls to 16-bit .DLL functions. However, in Visual FoxPro, the DECLARE command is the preferred method for calling .DLL functions.

The following code shows how to call Visual FoxPro Help and open the Search macro by using Foxtools.fll.

   SET LIBRARY TO HOME()+"FOXTOOLS.FLL"             && Locates Foxtools
   hhand=REGFN("WinHelp","ICIC","I")
   LPZFILENAME=alltrim(HOME())+"FOXHELP.HLP"
   WCOMMAND=258
   DWDATA="SEARCH()"
   declare Integer FindWindow in Win32Api String,String
   hwnd=FindWindow("","")
   HELP
   =CALLFN(hhand,hwnd,LPZFILENAME,WCOMMAND,DWDATA)
   RELEASE HHAND
   SET LIBRARY TO                                   && Releases Foxtools

The following code shows how to call Visual FoxPro Help using Declare:

   LPZFILENAME=HOME()+"FOXHELP.HLP"+CHR(0)
   HELP
   help_command=258
   Declare Integer WinHelp in Win32Api Integer, String, Integer, String
   =WinHelp(0,LPZFILENAME,help_command,"SEARCH()")

The following code shows how to call a specific Help topic within Visual FoxPro Help:

   LPZFILENAME=HOME()+"FOXHELP.HLP"+CHR(0)
   HELP
   help_partialkey=261
   Declare Integer WinHelp in Win32Api Integer, String, Integer, String
   =WinHelp(0,LPZFILENAME,help_partialkey,"form properties")

This example specifically calls the "Form Properties" Help topic. Experimentation with this will demonstrate various degrees of functionality. For example, altering the last line of code such that "form properties" is replaced with "form" will bring up the Search macro with the search index moved to "form."

For more information on creating Windows Help and the Help Compiler, please see the "Professional Features Guide" packaged with the Professional Edition of Microsoft Visual FoxPro.


Additional reference words: 3.00 VFoxWin
KBCategory: kbtool kbhowto kbcode
KBSubcategory: FxtoolWinhelp


THE INFORMATION PROVIDED IN THE MICROSOFT KNOWLEDGE BASE IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND. MICROSOFT DISCLAIMS ALL WARRANTIES, EITHER EXPRESS OR IMPLIED, INCLUDING THE WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. IN NO EVENT SHALL MICROSOFT CORPORATION OR ITS SUPPLIERS BE LIABLE FOR ANY DAMAGES WHATSOEVER INCLUDING DIRECT, INDIRECT, INCIDENTAL, CONSEQUENTIAL, LOSS OF BUSINESS PROFITS OR SPECIAL DAMAGES, EVEN IF MICROSOFT CORPORATION OR ITS SUPPLIERS HAVE BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. SOME STATES DO NOT ALLOW THE EXCLUSION OR LIMITATION OF LIABILITY FOR CONSEQUENTIAL OR INCIDENTAL DAMAGES SO THE FOREGOING LIMITATION MAY NOT APPLY.

Last reviewed: November 29, 1995
© 1998 Microsoft Corporation. All rights reserved. Terms of Use.