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
)
60 for (ih
= 0; ih
< g_cdh
; ++ih
)
62 if (!g_adh
[ ih
].fInUse
)
64 if (g_adh
[ ih
].idd
== idd
)
66 g_adh
[ ih
].adwContext
= adwContext
;
67 g_adh
[ ih
].idhOverview
= idhOverview
;
71 for (ih
= 0; ih
< g_cdh
; ++ih
)
73 if (!g_adh
[ ih
].fInUse
)
78 (void)REALLOC (g_adh
, g_cdh
, 1+ih
, 16);
82 g_adh
[ ih
].fInUse
= TRUE
;
83 g_adh
[ ih
].idd
= idd
;
84 g_adh
[ ih
].adwContext
= adwContext
;
85 g_adh
[ ih
].idhOverview
= idhOverview
;
90 BOOL
AfsAppLib_HandleHelp (int idd
, HWND hDlg
, UINT msg
, WPARAM wp
, LPARAM lp
)
101 for (ih
= 0; ih
< g_cdh
; ++ih
)
103 if (idd
== g_adh
[ ih
].idd
)
109 WinHelp (hDlg
, g_szHelpfile
, HELP_CONTEXT
, g_adh
[ ih
].idhOverview
);
118 for (ih
= 0; ih
< g_cdh
; ++ih
)
120 if (idd
== g_adh
[ ih
].idd
)
124 if ( (ih
== g_cdh
) ||
125 ((lphi
= (LPHELPINFO
)lp
) == NULL
) ||
126 (lphi
->hItemHandle
== NULL
) ||
127 (lphi
->hItemHandle
== hDlg
) )
129 PostMessage (hDlg
, WM_COMMAND
, (WPARAM
)MAKELONG(IDHELP
,BN_CLICKED
), (LPARAM
)GetDlgItem (hDlg
, IDHELP
));
134 WinHelp ((HWND
)(lphi
->hItemHandle
), g_szHelpfile
, HELP_WM_HELP
, (DWORD
)(DWORD_PTR
)g_adh
[ ih
].adwContext
);