Update NEWS for 1.6.22
[pkg-k5-afs_openafs.git] / src / WINNT / afs_setup_utils / progress_dlg.cpp
blob2471422c403208dff3341e95b6e40ce6588d928f
1 /*
2 * Copyright 2000, International Business Machines Corporation and others.
3 * All Rights Reserved.
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
8 */
11 * INCLUDES ___________________________________________________________________
14 extern "C" {
15 #include <afs/param.h>
16 #include <afs/stds.h>
19 #include <windows.h>
20 #include <WINNT/talocale.h>
21 #include "resource.h"
22 #include "progress_dlg.h"
23 #include "animate_icon.h"
27 * DEFINITIONS _________________________________________________________________
33 * Variables _________________________________________________________________
36 static HWND hDlg = 0; // HWND for this page's dialog
37 static char *pszProgressMsg = 0;
38 static HWND hLogo;
42 * PROTOTYPES _________________________________________________________________
45 BOOL CALLBACK ProgressDlgProc(HWND hRHS, UINT msg, WPARAM wp, LPARAM lp);
46 static DWORD WINAPI DisplayProgressDlg(LPVOID param);
47 static void OnInitDialog(HWND hwndDlg);
48 static void OnQuit();
52 * EXPORTED FUNCTIONS _________________________________________________________
55 BOOL ShowProgressDialog(char *pszMsg)
57 DWORD dwThreadID;
59 pszProgressMsg = pszMsg;
61 // Create a thread to show the dialog
62 HANDLE hThread = CreateThread(0, 0, DisplayProgressDlg, 0, 0, &dwThreadID);
64 CloseHandle(hThread);
66 return (hThread != 0);
69 void HideProgressDialog(void)
71 PostMessage(hDlg, WM_QUIT, 0, 0);
76 * Dialog Proc _________________________________________________________________
79 static BOOL CALLBACK ProgressDlgProc(HWND hwndDlg, UINT msg, WPARAM wp, LPARAM lp)
81 switch (msg) {
82 case WM_INITDIALOG:
83 OnInitDialog(hwndDlg);
84 hDlg = hwndDlg;
85 SetWindowText(GetDlgItem(hDlg, IDC_MSG), pszProgressMsg);
86 break;
88 case WM_QUIT:
89 OnQuit();
90 break;
93 return FALSE;
98 * Event Handler Functions __________________________________________________________
101 static void OnInitDialog(HWND hwndDlg)
103 hDlg = hwndDlg;
105 SetWindowText(GetDlgItem(hDlg, IDC_MSG), pszProgressMsg);
107 hLogo = GetDlgItem(hDlg, IDC_LOGO);
109 StartAnimation(hLogo, 8);
112 static void OnQuit()
114 StopAnimation(hLogo);
116 EndDialog(hDlg, IDOK);
121 * OTHER FUNCTIONS _________________________________________________________________
124 static DWORD WINAPI DisplayProgressDlg(LPVOID param)
126 ModalDialog (IDD_PROGRESS, 0, (DLGPROC)ProgressDlgProc);
128 return 0;