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 * VARIABLES __________________________________________________________________
23 static HWND g_hMain
= NULL
;
24 static TCHAR g_szAppName
[ cchNAME
] = TEXT("");
28 * PROTOTYPES _________________________________________________________________
32 extern void OnCoverWindow (WPARAM wp
, LPARAM lp
);
33 extern void OnExpiredCredentials (WPARAM wp
, LPARAM lp
);
34 extern void OnCreateErrorDialog (WPARAM wp
, LPARAM lp
);
36 HRESULT CALLBACK
AfsAppLib_MainHook (HWND hDlg
, UINT msg
, WPARAM wp
, LPARAM lp
);
40 * ROUTINES ___________________________________________________________________
44 void AfsAppLib_SetAppName (LPTSTR pszName
)
46 lstrcpy (g_szAppName
, pszName
);
50 void AfsAppLib_GetAppName (LPTSTR pszName
)
52 lstrcpy (pszName
, g_szAppName
);
56 void AfsAppLib_SetMainWindow (HWND hMain
)
59 Subclass_RemoveHook (g_hMain
, AfsAppLib_MainHook
);
61 if ((g_hMain
= hMain
) != NULL
)
62 Subclass_AddHook (g_hMain
, AfsAppLib_MainHook
);
66 HWND
AfsAppLib_GetMainWindow (void)
72 HRESULT CALLBACK
AfsAppLib_MainHook (HWND hWnd
, UINT msg
, WPARAM wp
, LPARAM lp
)
74 PVOID oldProc
= Subclass_FindNextHook (hWnd
, AfsAppLib_MainHook
);
79 OnCoverWindow (wp
, lp
);
82 case WM_EXPIRED_CREDENTIALS
:
83 OnExpiredCredentials (wp
, lp
);
86 case WM_CREATE_ERROR_DIALOG
:
87 OnCreateErrorDialog (wp
, lp
);
91 AfsAppLib_SetMainWindow (NULL
);
96 return (CallWindowProc ((WNDPROC
)oldProc
, hWnd
, msg
, wp
, lp
));
98 return (DefWindowProc (hWnd
, msg
, wp
, lp
));