Conditionally Activating a Button in Windows Help

Last reviewed: May 2, 1996
Article ID: Q76534
The information in this article applies to:
  • Microsoft Windows Software Development Kit (SDK) version 3.1
  • Microsoft Win32 SDK, versions 3.5, 3.51, and 4.0

SUMMARY

An application can add buttons to the Windows Help engine button bar. There may be times when the button should be activated or deactivated based on an external condition.

For example, if an application adds a tutorial button to the bar and the user has not chosen to install the tutorial, the button should be dimmed to indicate that the tutorial is not available.

MORE INFORMATION

The following code fragment demonstrates activating and deactivating buttons using the macro facility:

char szMacro[255];
    .
    .
    .
/* Bring up the Help engine with the HLP file   */
/* This code fragment assumes that a button has */
/* been defined with an ID of TUTORIAL_BUTTON   */
WinHelp (hWnd, lpHelpFile, HELP_CONTENTS, 0L)

if (fTutorial)

/* If the tutorial is installed, the macro should enable the button */
     lstrcpy(szMacro,"EnableButton(`TUTORIAL_BUTTON')");
else
/* If the tutorial is not installed, the macro should disable the
   button */
    lstrcpy(szMacro,"DisableButton(`TUTORIAL_BUTTON')");

/* Note that the single quote character before TUTORIAL must be a backquote
/* (`) for the function to work correctly.

/* Run the appropriate macro */
WinHelp (hWnd, lpHelpFile, HELP_COMMAND, (LONG)szMacro);


Additional reference words: 3.10 3.50 4.00 95 grayed out disabled
unavailable
KBCategory: kbtool
KBSubcategory: TlsHlp


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: May 2, 1996
© 1998 Microsoft Corporation. All rights reserved. Terms of Use.