Conditionally Activating a Button in Windows Help

ID: Q76534


The information in this article applies to:


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 query words: 3.10 3.50 4.00 95 grayed out disabled unavailable win16sdk


Keywords          : TlsHlp 
Version           : 3.10 4.00 | 3.50 3.51
Platform          : NT WINDOWS 
Issue type        : 

Last Reviewed: March 5, 1999