Microsoft KB Archive/76534

{|
 * width="100%"|

Conditionally Activating a Button in Windows Help

 * }

Q76534

-

The information in this article applies to:


 * Microsoft Windows Software Development Kit (SDK) 3.1
 * Microsoft Win32 Software Development Kit (SDK), versions 3.5, 3.51, 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,&quot;EnableButton(`TUTORIAL_BUTTON')&quot;);

else

/* If the tutorial is not installed, the macro should disable the button */ lstrcpy(szMacro,&quot;DisableButton(`TUTORIAL_BUTTON')&quot;);

/* 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 :

Issue type :

Technology : kbWin32SDKSearch kbAudDeveloper kbWin3xSearch kbSDKSearch kbWin32sSearch kbWin32SDK400 kbWin32SDK350 kbWin32SDK351 kbWinSDKSearch kbWinSDK310