2 * Copyright 2000, International Business Machines Corporation and others.
5 * This software has been released under the terms of the IBM Public
6 * License. For details, see the LICENSE file in the top-level source
7 * directory or online at http://www.openafs.org/dl/license10.html
11 #include <afs/param.h>
15 #include <WINNT/afsapplib.h>
19 * DEFINITIONS ______________________________________________________________
29 } DIALOGHELP, *LPDIALOGHELP;
33 * VARIABLES ________________________________________________________________
37 static TCHAR g_szHelpfile[ MAX_PATH ] = TEXT("");
39 static DIALOGHELP *g_adh = NULL;
40 static size_t g_cdh = 0;
44 * ROUTINES _________________________________________________________________
48 void AfsAppLib_RegisterHelpFile (LPTSTR pszFilename)
51 lstrcpy (g_szHelpfile, pszFilename);
53 g_szHelpfile[0] = TEXT('\0');
57 void AfsAppLib_RegisterHelp (int idd, DWORD *adwContext, int idhOverview)
59 for (size_t ih = 0; ih < g_cdh; ++ih)
61 if (!g_adh[ ih ].fInUse)
63 if (g_adh[ ih ].idd == idd)
65 g_adh[ ih ].adwContext = adwContext;
66 g_adh[ ih ].idhOverview = idhOverview;
70 for (ih = 0; ih < g_cdh; ++ih)
72 if (!g_adh[ ih ].fInUse)
77 (void)REALLOC (g_adh, g_cdh, 1+ih, 16);
81 g_adh[ ih ].fInUse = TRUE;
82 g_adh[ ih ].idd = idd;
83 g_adh[ ih ].adwContext = adwContext;
84 g_adh[ ih ].idhOverview = idhOverview;
89 BOOL AfsAppLib_HandleHelp (int idd, HWND hDlg, UINT msg, WPARAM wp, LPARAM lp)
100 for (ih = 0; ih < g_cdh; ++ih)
102 if (idd == g_adh[ ih ].idd)
108 WinHelp (hDlg, g_szHelpfile, HELP_CONTEXT, g_adh[ ih ].idhOverview);
117 for (ih = 0; ih < g_cdh; ++ih)
119 if (idd == g_adh[ ih ].idd)
123 if ( (ih == g_cdh) ||
124 ((lphi = (LPHELPINFO)lp) == NULL) ||
125 (lphi->hItemHandle == NULL) ||
126 (lphi->hItemHandle == hDlg) )
128 PostMessage (hDlg, WM_COMMAND, (WPARAM)MAKELONG(IDHELP,BN_CLICKED), (LPARAM)GetDlgItem (hDlg, IDHELP));
133 WinHelp ((HWND)(lphi->hItemHandle), g_szHelpfile, HELP_WM_HELP, (DWORD)g_adh[ ih ].adwContext);