1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
|
#include ".main.h"
#include <commctrl.h>
#include <shlobj.h>
#include "resource.h"
BOOL CALLBACK SilentDlgProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam)
{
switch(uMsg)
{
case WM_INITDIALOG:
{
HICON hIcon = LoadIcon(GetModuleHandle(NULL), MAKEINTRESOURCE(ICON_XP));
SetClassLongPtr(hwndDlg, GCLP_HICON, (LONG_PTR)hIcon);
HWND hwndPrg = GetDlgItem(hwndDlg, IDC_PRG_COLLECT);
SendMessage(hwndPrg, PBM_SETRANGE, 0, MAKELPARAM(0,100));
SendMessage(hwndPrg, PBM_SETPOS, 0, 0);
SetDlgItemText(hwndDlg, IDC_LBL_STEP, L"Starting reporter...");
ShowWindow(GetDlgItem(hwndDlg, IDC_BUTTON1), SW_HIDE);
ShowWindow(GetDlgItem(hwndDlg, IDC_BUTTON2), SW_HIDE);
UpdateWindow(hwndDlg);
if ((settings.createLOG && !settings.ReadLogCollectResult()) &&
(settings.createDMP && !settings.ReadDmpCollectResult()) )
{
SetDlgItemText(hwndDlg, IDC_LBL_STEP, L"Error. Data was not generated.");
SendMessage(hwndPrg, PBM_SETPOS, 100, 0);
UpdateWindow(hwndDlg);
SetTimer(hwndDlg, 126, 2000, NULL);
break;
}
SetTimer(hwndDlg, 123, 500, NULL);
break;
}
case WM_COMMAND:
switch(LOWORD(wParam))
{
case IDC_BUTTON1:
{
BOOL ret = FALSE;
wchar_t file[MAX_PATH] = {0};
lstrcpyn(file, settings.zipPath, MAX_PATH);
LPSHELLFOLDER pDesktopFolder = 0;
if(SUCCEEDED(SHGetDesktopFolder(&pDesktopFolder)))
{
LPITEMIDLIST filepidl = 0;
HRESULT hr = pDesktopFolder->ParseDisplayName(NULL,0,file,0,&filepidl,0);
if(FAILED(hr)){ pDesktopFolder->Release(); ret = FALSE; }
else
{
if(SUCCEEDED(SHOpenFolderAndSelectItems(filepidl,0,NULL,NULL))){
ret = TRUE;
}
}
}
if (ret == FALSE)
{
SetDlgItemText(hwndDlg, IDC_LBL_STEP, L"Error. Unable to locate crash report.");
UpdateWindow(hwndDlg);
}
}
break;
case IDCANCEL:
case IDC_BUTTON2:
SetTimer(hwndDlg, 126, 1, NULL);
break;
}
break;
case WM_TIMER:
if (wParam == 123)
{
KillTimer(hwndDlg, wParam);
HWND hwndPrg;
hwndPrg = GetDlgItem(hwndDlg, IDC_PRG_COLLECT);
SendMessage(hwndPrg, PBM_SETPOS, 20, 0);
if (settings.zipData)
{
SetDlgItemText(hwndDlg, IDC_LBL_STEP, L"Packing results...");
if(!ZipData())
{
SetDlgItemText(hwndDlg, IDC_LBL_STEP, L"Error. Unable to pack results.");
SendMessage(hwndPrg, PBM_SETPOS, 100, 0);
UpdateWindow(hwndDlg);
SetTimer(hwndDlg, 126, 2000, NULL);
break;
}
}
SendMessage(hwndPrg, PBM_SETPOS, 40, 0);
UpdateWindow(hwndDlg);
if (settings.sendData)
{
SetDlgItemText(hwndDlg, IDC_LBL_STEP, L"Sending results...");
UpdateWindow(hwndDlg);
if(!SendData(hwndDlg))
{
SetDlgItemText(hwndDlg, IDC_LBL_STEP, L"Error. Unable to send crash report.");
SendMessage(hwndPrg, PBM_SETPOS, 100, 0);
ShowWindow(GetDlgItem(hwndDlg, IDC_BUTTON1), SW_SHOW);
ShowWindow(GetDlgItem(hwndDlg, IDC_BUTTON2), SW_SHOW);
ShowWindow(GetDlgItem(hwndDlg, IDC_PRG_COLLECT), SW_HIDE);
UpdateWindow(hwndDlg);
break;
}
}
if (settings.autoRestart)
{
SetDlgItemText(hwndDlg, IDC_LBL_STEP, L"Restarting Winamp...");
SendMessage(hwndPrg, PBM_SETPOS, 80, 0);
UpdateWindow(hwndDlg);
if(!Restart())
{
SetDlgItemText(hwndDlg, IDC_LBL_STEP, L"Error. Unable to restart Winamp.");
SendMessage(hwndPrg, PBM_SETPOS, 100, 0);
UpdateWindow(hwndDlg);
SetTimer(hwndDlg, 126, 2000, NULL);
break;
}
}
SetDlgItemText(hwndDlg, IDC_LBL_STEP, L"Done.");
SendMessage(hwndPrg, PBM_SETPOS, 100, 0);
UpdateWindow(hwndDlg);
SetTimer(hwndDlg, 126, 1000, NULL);
}
else if (wParam == 126)
{
KillTimer(hwndDlg, wParam);
EndDialog(hwndDlg, TRUE);
}
break;
}
return FALSE;
}
|