-
Notifications
You must be signed in to change notification settings - Fork 5
Expand file tree
/
Copy pathScanDialog.cpp
More file actions
98 lines (76 loc) · 2.16 KB
/
ScanDialog.cpp
File metadata and controls
98 lines (76 loc) · 2.16 KB
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
// ScanDialog.cpp : implementation file
//
#include "stdafx.h"
#include "iPodWizard.h"
#include "ScanDialog.h"
#include ".\scandialog.h"
// CScanDialog dialog
IMPLEMENT_DYNAMIC(CScanDialog, CDialog)
CScanDialog::CScanDialog(CWnd* pParent /*=NULL*/)
: CDialog(CScanDialog::IDD, pParent)
{
}
CScanDialog::~CScanDialog()
{
}
void CScanDialog::DoDataExchange(CDataExchange* pDX)
{
CDialog::DoDataExchange(pDX);
DDX_Control(pDX, IDC_SCAN_PROGRESS, m_ProgressCtrl);
}
BEGIN_MESSAGE_MAP(CScanDialog, CDialog)
ON_MESSAGE(WM_APP, OnScanProgress)
END_MESSAGE_MAP()
// CScanDialog message handlers
BOOL CScanDialog::OnInitDialog()
{
CDialog::OnInitDialog();
// TODO: Add extra initialization here
return TRUE; // return TRUE unless you set the focus to a control
// EXCEPTION: OCX Property Pages should return FALSE
}
void CScanDialog::ScanFirmware(CFirmware *pFirmware, DWORD size)
{
if (pFirmware)
{
m_ProgressCtrl.SetRange32(0, pFirmware->GetFirmwareSize());
m_ProgressCtrl.SetPos(0);
pFirmware->ScanFirmware(this);
}
else
{
m_ProgressCtrl.SetRange32(0, size);
m_ProgressCtrl.SetPos(0);
}
}
LRESULT CScanDialog::OnScanProgress(WPARAM wParam, LPARAM lParam)
{
if (wParam != NULL)
{
SetWindowText((LPCTSTR)wParam);
}
UpdateDisplay();
m_ProgressCtrl.SetPos((int)lParam);
m_ProgressCtrl.UpdateWindow();
return 0;
}
void CScanDialog::UpdateDisplay()
{
this->UpdateWindow();
MSG message;
if (::PeekMessage(&message, this->m_hWnd, 0, 0, PM_REMOVE)) {
// periodically (every 10000 cycles) check for messages
// in particular the Timer message
// Notice this is the message pump we say earlier in WinMain loop!
::TranslateMessage(&message);
::DispatchMessage(&message);
}
this->GetParent()->UpdateWindow();
if (::PeekMessage(&message, this->GetParent()->m_hWnd, 0, 0, PM_REMOVE)) {
// periodically (every 10000 cycles) check for messages
// in particular the Timer message
// Notice this is the message pump we say earlier in WinMain loop!
::TranslateMessage(&message);
::DispatchMessage(&message);
}
}