rlm@1
|
1 // Throttle.cpp : implementation file
|
rlm@1
|
2 //
|
rlm@1
|
3
|
rlm@1
|
4 #include "stdafx.h"
|
rlm@1
|
5 #include "resource.h"
|
rlm@1
|
6 #include "Throttle.h"
|
rlm@1
|
7 #include "../common/System.h" // for system messages
|
rlm@1
|
8
|
rlm@1
|
9 /////////////////////////////////////////////////////////////////////////////
|
rlm@1
|
10 // Throttle dialog
|
rlm@1
|
11
|
rlm@1
|
12 Throttle::Throttle(CWnd*pParent /*=NULL*/)
|
rlm@1
|
13 : CDialog(Throttle::IDD, pParent)
|
rlm@1
|
14 {
|
rlm@1
|
15 //{{AFX_DATA_INIT(Throttle)
|
rlm@1
|
16 m_throttle = 100;
|
rlm@1
|
17 //}}AFX_DATA_INIT
|
rlm@1
|
18 }
|
rlm@1
|
19
|
rlm@1
|
20 void Throttle::DoDataExchange(CDataExchange*pDX)
|
rlm@1
|
21 {
|
rlm@1
|
22 CDialog::DoDataExchange(pDX);
|
rlm@1
|
23 //{{AFX_DATA_MAP(Throttle)
|
rlm@1
|
24 DDX_Text(pDX, IDC_THROTTLE, m_throttle);
|
rlm@1
|
25 //}}AFX_DATA_MAP
|
rlm@1
|
26 }
|
rlm@1
|
27
|
rlm@1
|
28 BEGIN_MESSAGE_MAP(Throttle, CDialog)
|
rlm@1
|
29 //{{AFX_MSG_MAP(Throttle)
|
rlm@1
|
30 ON_BN_CLICKED(ID_CANCEL, OnCancel)
|
rlm@1
|
31 ON_BN_CLICKED(ID_OK, OnOk)
|
rlm@1
|
32 //}}AFX_MSG_MAP
|
rlm@1
|
33 END_MESSAGE_MAP()
|
rlm@1
|
34
|
rlm@1
|
35 /////////////////////////////////////////////////////////////////////////////
|
rlm@1
|
36 // Throttle message handlers
|
rlm@1
|
37
|
rlm@1
|
38 BOOL Throttle::OnInitDialog()
|
rlm@1
|
39 {
|
rlm@1
|
40 CDialog::OnInitDialog();
|
rlm@1
|
41
|
rlm@1
|
42 CenterWindow();
|
rlm@1
|
43
|
rlm@1
|
44 return TRUE; // return TRUE unless you set the focus to a control
|
rlm@1
|
45 // EXCEPTION: OCX Property Pages should return FALSE
|
rlm@1
|
46 }
|
rlm@1
|
47
|
rlm@1
|
48 void Throttle::OnCancel()
|
rlm@1
|
49 {
|
rlm@1
|
50 EndDialog(false);
|
rlm@1
|
51 }
|
rlm@1
|
52
|
rlm@1
|
53 void Throttle::OnOk()
|
rlm@1
|
54 {
|
rlm@1
|
55 UpdateData();
|
rlm@1
|
56
|
rlm@1
|
57 if (m_throttle < 1 || m_throttle > 1000)
|
rlm@1
|
58 systemMessage(IDS_INVALID_THROTTLE_VALUE, "Invalid throttle value. Please enter a number between 1 and 1000");
|
rlm@1
|
59 else
|
rlm@1
|
60 EndDialog(m_throttle);
|
rlm@1
|
61 }
|
rlm@1
|
62
|