forked from vsite-nwp/v03
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmain.cpp
More file actions
46 lines (42 loc) · 759 Bytes
/
Copy pathmain.cpp
File metadata and controls
46 lines (42 loc) · 759 Bytes
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
#include <windows.h>
#include "nwpdlg.h"
#include "resource.h"
class MyDialog : public Dialog
{
public:
POINT pos;
protected:
int IDD()
{
return IDD_DIALOG1;
}
bool OnInitDialog()
{
SetInt(IDC_EDIT1, pos.x);
SetInt(IDC_EDIT2, pos.y);
return true;
}
bool OnOK()
{
try {
pos.x = GetInt(IDC_EDIT1);
pos.y = GetInt(IDC_EDIT2);
}
catch (XCtrl) {
return false;
}
return true;
}
void OnCancel() { }
bool OnCommand(int id, int code) { return false; }
};
int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hp, LPSTR cmdLine, int nShow)
{
MyDialog dlg;
GetCursorPos(&dlg.pos);
if(dlg.DoModal(hInstance, NULL) == IDOK)
{
SetCursorPos(dlg.pos.x, dlg.pos.y);
}
return 0;
}