-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathPostDPIDialog.cpp
80 lines (57 loc) · 1.72 KB
/
PostDPIDialog.cpp
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
// PostDPIDialog.cpp : implementation file
//
#include "stdafx.h"
#include "TomatoAnalyzer.h"
#include "PostDPIDialog.h"
#include "afxdialogex.h"
#include <cstring>
#include <iostream>
#include <fstream>
// PostDPIDialog dialog
IMPLEMENT_DYNAMIC(PostDPIDialog, CDialog)
PostDPIDialog::PostDPIDialog(CWnd* pParent /*=NULL*/)
: CDialog(PostDPIDialog::IDD, pParent)
{
num_units = 0;
}
PostDPIDialog::~PostDPIDialog()
{
}
void PostDPIDialog::DoDataExchange(CDataExchange* pDX)
{
CDialog::DoDataExchange(pDX);
DDX_Text(pDX, IDC_NUM_UNITS, num_units);
}
BEGIN_MESSAGE_MAP(PostDPIDialog, CDialog)
ON_EN_CHANGE(IDC_NUM_UNITS, &PostDPIDialog::OnEnChangeNumUnits)
END_MESSAGE_MAP()
// PostDPIDialog message handlers
void PostDPIDialog::OnEnChangeNumUnits()
{
// TODO: If this is a RICHEDIT control, the control will not
// send this notification unless you override the CDialog::OnInitDialog()
// function and call CRichEditCtrl().SetEventMask()
// with the ENM_CHANGE flag ORed into the mask.
// TODO: Add your control notification handler code here
}
double PostDPIDialog::get_num_units() {
/*
double units = 0;
auto text = (CEdit*) (this->m_hWnd, IDC_NUM_UNITS);
if (text == NULL) {
exit(0);
}
std::ofstream ofs;
ofs.open("C:\\Users\\madmax\\test.txt", std::ofstream::out | std::ofstream::app);
char *buffer = new char[text->GetWindowTextLength() + 1];
memset(buffer, 0, text->GetWindowTextLength() + 1);
CString foo;
text->GetWindowTextA(buffer, text->GetWindowTextLengthA());
GetDlgItemText(IDC_NUM_UNITS, foo);
ofs << num_units << std::endl;
ofs.close();
units = atof(buffer);
delete[] buffer;
return units;*/
return num_units;
}