-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathProgressBar.cpp
More file actions
58 lines (45 loc) · 1.57 KB
/
ProgressBar.cpp
File metadata and controls
58 lines (45 loc) · 1.57 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
// ProgressBar.cpp : implementation file
//
#include "stdafx.h"
#include "AnMap.h"
#include "ProgressBar.h"
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif
/////////////////////////////////////////////////////////////////////////////
// CProgressBar
CProgressBar::CProgressBar()
{
}
CProgressBar::~CProgressBar()
{
}
BEGIN_MESSAGE_MAP(CProgressBar, CProgressCtrl)
//{{AFX_MSG_MAP(CProgressBar)
// NOTE - the ClassWizard will add and remove mapping macros here.
//}}AFX_MSG_MAP
END_MESSAGE_MAP()
/////////////////////////////////////////////////////////////////////////////
// CProgressBar message handlers
BOOL CProgressBar::Create(LPCTSTR lpszClassName, LPCTSTR lpszWindowName, DWORD dwStyle, const RECT& rect, CWnd* pParentWnd, UINT nID, CCreateContext* pContext)
{
// 상태바를 얻음
CStatusBar *pStatusBar = GetStatusBar();
if( !pStatusBar ) return FALSE;
// 상태바 위에 프로그레스 컨트롤 생성
if( !CProgressCtrl::Create(WS_CHILD | WS_VISIBLE, CRect(0,0,0,0), pStatusBar, 1)) return FALSE;
// 프로그레스 컨트롤의 범위와 스텝 설정
SetRange(0, 100);
SetStep(1);
return CWnd::Create(lpszClassName, lpszWindowName, dwStyle, rect, pParentWnd, nID, pContext);
}
CStatusBar* CProgressBar::GetStatusBar()
{
CFrameWnd *pFrame = (CFrameWnd*)AfxGetMainWnd();
if(!pFrame || !pFrame->IsKindOf(RUNTIME_CLASS(CFrameWnd))) return NULL;
CStatusBar *pBar = (CStatusBar*) pFrame->GetMessageBar();
if( !pBar || !pBar->IsKindOf(RUNTIME_CLASS(CStatusBar))) return NULL;
return pBar;
}