~ubuntu-branches/ubuntu/warty/openafs/warty

« back to all changes in this revision

Viewing changes to src/WINNT/afs_setup_utils/progress_dlg.cpp

  • Committer: Bazaar Package Importer
  • Author(s): Sam Hartman
  • Date: 2004-01-10 16:37:33 UTC
  • Revision ID: james.westby@ubuntu.com-20040110163733-jvr0n1uahshlb1uu
Tags: upstream-1.2.11
ImportĀ upstreamĀ versionĀ 1.2.11

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/*
 
2
 * Copyright 2000, International Business Machines Corporation and others.
 
3
 * All Rights Reserved.
 
4
 * 
 
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
 */
 
9
 
 
10
/*
 
11
 * INCLUDES ___________________________________________________________________
 
12
 *
 
13
 */
 
14
extern "C" {
 
15
#include <afs/param.h>
 
16
#include <afs/stds.h>
 
17
}
 
18
 
 
19
#include <windows.h>
 
20
#include <WINNT/talocale.h>
 
21
#include "resource.h"
 
22
#include "progress_dlg.h"
 
23
#include "animate_icon.h"
 
24
 
 
25
 
 
26
/*
 
27
 * DEFINITIONS _________________________________________________________________
 
28
 *
 
29
 */
 
30
 
 
31
 
 
32
/*
 
33
 * Variables _________________________________________________________________
 
34
 *
 
35
 */
 
36
static HWND hDlg = 0;                                           // HWND for this page's dialog
 
37
static char *pszProgressMsg = 0;
 
38
static HWND hLogo;
 
39
 
 
40
 
 
41
/*
 
42
 * PROTOTYPES _________________________________________________________________
 
43
 *
 
44
 */
 
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();
 
49
 
 
50
 
 
51
/*
 
52
 * EXPORTED FUNCTIONS _________________________________________________________
 
53
 *
 
54
 */
 
55
BOOL ShowProgressDialog(char *pszMsg)
 
56
{
 
57
        DWORD dwThreadID;
 
58
        
 
59
    pszProgressMsg = pszMsg;
 
60
 
 
61
        // Create a thread to show the dialog
 
62
        HANDLE hThread = CreateThread(0, 0, DisplayProgressDlg, 0, 0, &dwThreadID);
 
63
 
 
64
        CloseHandle(hThread);
 
65
 
 
66
    return (hThread != 0);
 
67
}
 
68
 
 
69
void HideProgressDialog(void)
 
70
{
 
71
    PostMessage(hDlg, WM_QUIT, 0, 0);
 
72
}
 
73
 
 
74
 
 
75
/*
 
76
 * Dialog Proc _________________________________________________________________
 
77
 *
 
78
 */
 
79
static BOOL CALLBACK ProgressDlgProc(HWND hwndDlg, UINT msg, WPARAM wp, LPARAM lp)
 
80
{
 
81
        switch (msg) {
 
82
                case WM_INITDIALOG:
 
83
            OnInitDialog(hwndDlg);
 
84
                        hDlg = hwndDlg;
 
85
            SetWindowText(GetDlgItem(hDlg, IDC_MSG), pszProgressMsg);
 
86
                        break;
 
87
    
 
88
        case WM_QUIT:
 
89
            OnQuit();            
 
90
            break;
 
91
    }
 
92
 
 
93
    return FALSE;
 
94
}
 
95
 
 
96
 
 
97
/*
 
98
 * Event Handler Functions __________________________________________________________
 
99
 *
 
100
 */
 
101
static void OnInitDialog(HWND hwndDlg)
 
102
{
 
103
    hDlg = hwndDlg;
 
104
 
 
105
    SetWindowText(GetDlgItem(hDlg, IDC_MSG), pszProgressMsg);
 
106
 
 
107
    hLogo = GetDlgItem(hDlg, IDC_LOGO);
 
108
 
 
109
    StartAnimation(hLogo, 8);
 
110
}
 
111
 
 
112
static void OnQuit()
 
113
{
 
114
    StopAnimation(hLogo);
 
115
 
 
116
    EndDialog(hDlg, IDOK);
 
117
}
 
118
 
 
119
 
 
120
/*
 
121
 * OTHER FUNCTIONS _________________________________________________________________
 
122
 *
 
123
 */
 
124
static DWORD WINAPI DisplayProgressDlg(LPVOID param)
 
125
{
 
126
        ModalDialog (IDD_PROGRESS, 0, (DLGPROC)ProgressDlgProc);
 
127
 
 
128
        return 0;
 
129
}
 
130