This repository has been archived by the owner on Jun 24, 2018. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 1
/
frmain.cpp
68 lines (60 loc) · 1.55 KB
/
frmain.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
#include"GUI.h"
form main("form", "E-Land Chord Converter",240,240,960,528);
int pix = 80;
char f[MAX_PATH];
button scan(&main, 5 * pix, 200, 112, 56, "Go!");
Label info(&main, 0, 464, 560, 24, "");
extern int go(std::string f);
int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR szCmdLine, int iCmdShow) {
main.create();
main.Event_Window_Resize = [](form* me) {
pix = me->w / 12;
};
scan.Event_On_Click = [](button* me) {
OPENFILENAME ofn;
ZeroMemory(&ofn, sizeof(ofn));
ofn.lStructSize = sizeof(ofn);
ofn.hwndOwner = main.hWnd;
ofn.lpstrDefExt = 0;
ofn.lpstrFile = f;
ofn.lpstrFile[0] = '\0';
ofn.nMaxFile = MAX_PATH;
ofn.lpstrFilter = "ͼƬÎļþ\0*.bmp;*.jpg;*.JPG;*.jpeg;*.png;*.gif\0\0";
ofn.nFilterIndex = 0;
ofn.lpstrInitialDir = 0;
ofn.lpstrTitle = "Ñ¡ÔñÀÖÆ×£º";
ofn.Flags = OFN_PATHMUSTEXIST | OFN_FILEMUSTEXIST;
if (GetOpenFileName(&ofn))
{
info.name = f;
if (go(std::string(f)) == 0) {
info.name = "success";
}
else {
info.name = "failure";
}
main.show();
}
};
main.Event_Load_Complete = [](form* me) {
pix = me->w / 12;
};
button home(&main, 8, 0, 112, 56, "Home");
button history(&main, 8, 64, 112, 56, "History");
button setting(&main, 8, 128, 112, 56, "Settings");
button exit(&main, 8, 400, 112, 56, "Exit");
home.Event_On_Click = [](button* me) {
scan.show();
};
exit.Event_On_Click = [](button* me) {
void* p = me->parent;
((form*)p)->close();
};
scan.create();
home.create();
history.create();
setting.create();
exit.create();
info.create();
main();
}