Skip to content

Commit 47ce7fe

Browse files
committed
Added licence and minor tweak
1 parent 735f781 commit 47ce7fe

1 file changed

Lines changed: 26 additions & 6 deletions

File tree

spikes/winsetres/winsetres/winsetres.cpp

Lines changed: 26 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,23 @@
1+
///////////////////////////////////////////////////////////////////////////////
2+
//
3+
// winsetres.cpp
4+
//
5+
// Copyright 2014 OpenDirective Ltd.
6+
//
7+
// Licensed under the New BSD license. You may not use this file except in
8+
// compliance with this License.
9+
//
10+
// You may obtain a copy of the License at
11+
// https://github.com/gpii/windows/blob/master/LICENSE.txt
12+
//
13+
// The research leading to these results has received funding from
14+
// the European Union's Seventh Framework Programme (FP7/2007-2013)
15+
// under grant agreement no. 289016.
16+
//
17+
// Spike to test changing resolution on Windows
18+
//
19+
///////////////////////////////////////////////////////////////////////////////
20+
121
#include <SDKDDKVer.h>
222
#include <windows.h>
323
#include <tchar.h>
@@ -42,7 +62,7 @@ static BOOL setScreenResolution(SIZE res)
4262
dmCurrent.dmPelsWidth = width;
4363
dmCurrent.dmPelsHeight = height;
4464
long lRet = ChangeDisplaySettings(&dmCurrent, 0);
45-
if (DISP_CHANGE_SUCCESSFUL == lRet)
65+
if (DISP_CHANGE_SUCCESSFUL == lRet)
4666
{
4767
return TRUE;
4868
}
@@ -64,19 +84,19 @@ int _tmain(int argc, _TCHAR* argv[])
6484
static wchar_t buf[100];
6585

6686
SIZE res = getScreenResolution();
67-
swprintf_s(buf, _countof(buf), L"%u %u\r\n", res.cx, res.cy);
87+
swprintf_s(buf, _countof(buf), L"Current: %u %u\r\n", res.cx, res.cy);
6888
wprintf(buf);
6989

7090
if (argc > 2)
7191
{
7292
SIZE newRes = { _wtoi(argv[1]), _wtoi(argv[2]) };
7393
BOOL r = setScreenResolution(newRes);
7494
printf((r) ? "Set OK\r\n" : "Set Failed\r\n");
75-
}
7695

77-
res = getScreenResolution();
78-
swprintf_s(buf, _countof(buf), L"%u %u\r\n", res.cx, res.cy);
79-
wprintf(buf);
96+
res = getScreenResolution();
97+
swprintf_s(buf, _countof(buf), L"New: %u %u\r\n", res.cx, res.cy);
98+
wprintf(buf);
99+
}
80100

81101
return 0;
82102
}

0 commit comments

Comments
 (0)